@@ -119,26 +119,8 @@ function tournament(players){
119
119
}
120
120
121
121
122
- /////////// Prompt 10 ///////////
123
- /////////// time complexity:
124
- function tournamentRedux ( players ) {
125
- var results ;
126
- if ( players . length < 3 ) {
127
- return players [ 0 ] ;
128
- } else {
129
- for ( i = 0 ; i < players . length ; i = i + 3 ) {
130
- results . push ( hotPotato ( [ players [ i ] , players [ i + 1 ] , players [ i + 2 ] ] ) ) ;
131
- //assume hotPotato is a function where
132
- //the three players at a time must play hot potato for 5 minutes.
133
- //the player in the room holding the potato is the winner
134
- //and gets returned from the function
135
- }
136
- return tournament ( results ) ;
137
- }
138
- }
139
-
140
122
141
- /////////// Prompt 11 ///////////
123
+ /////////// Prompt 10 ///////////
142
124
/////////// time complexity:
143
125
function allPasswords ( allowedChars , maxLength ) {
144
126
var results = [ ] ;
@@ -159,7 +141,7 @@ function allPasswords(allowedChars, maxLength){
159
141
}
160
142
161
143
162
- /////////// Prompt 12 ///////////
144
+ /////////// Prompt 11 ///////////
163
145
/////////// time complexity:
164
146
function findColor ( quadTree , coordinates ) {
165
147
//a quad tree is a tree where each node has 4 children
@@ -206,6 +188,28 @@ function findColor(quadTree, coordinates){
206
188
207
189
208
190
191
+ /////////// Bonus! ///////////
192
+ /////////// time complexity:
193
+ //this will require some math to determine
194
+
195
+ function tournamentRedux ( players ) {
196
+ var results ;
197
+ if ( players . length < 3 ) {
198
+ return players [ 0 ] ;
199
+ } else {
200
+ for ( i = 0 ; i < players . length ; i = i + 3 ) {
201
+ results . push ( hotPotato ( [ players [ i ] , players [ i + 1 ] , players [ i + 2 ] ] ) ) ;
202
+ //assume hotPotato is a function where
203
+ //the three players at a time must play hot potato for 5 minutes.
204
+ //the player in the room holding the potato is the winner
205
+ //and gets returned from the function
206
+ }
207
+ return tournament ( results ) ;
208
+ }
209
+ }
210
+
211
+
212
+
209
213
210
214
211
215
0 commit comments