# Day 11, N queens and bit shifting

Today is crazy and most people agreed that this is one of the hardest sprint so far. Marcus made a deliberate point that the N queens sprint tends to divide people into two groups. As a matter of fact, I can provide anecdotes. At least one person said “this is one of the most awesome sprints” and at least one person said the other way.

Zak and I were average in this sprint. We made solid progresses and finished all basic requirements plus some extra credits. The road map of optimization is : using all the helper functions provided -> using HashTables -> using bit shifting. We got the HashTable version up and  running, and I was disappointed that the speed boost wasn’t as big as I expected. Zak spent tons of time on bit shifting but we didn’t have to time to implement it.

Anyway, an exhausting two days. The most difficult concept for me is to recursively traverse all possible arrangements on the board. Recursive traversing is such a hard concept in general that I still need sometime to really get it.

Now I know at least two solutions to traverse. One is to toggle on the location before going to the next row and toggle off  when finished. The other is to pass two parameters, namely a prefix and a bag. I got the toggle version working. I got the prefix and bag solution to work on traversing a tony matrix, so the solution is close.

Other lessons:

– There are 3 ways to solve the 1to5 to 1to7 problem. First one is the one I used, throwing dice seven times; second one is using a 5 by 5 matrix, basically only throwing dice twice; third one is using bit shifting. Not 100% sure about the other two ways.

– Also learned about “grep – R ‘searchterm’ * “; ENV_VAR = 1, then echo \$ENV_VAR. I keep forgetting about the \$prefix…