| 
									
										
										
										
											2011-08-15 12:54:11 -06:00
										 |  |  | Stack (vanilla C) | 
					
						
							|  |  |  | === | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Implement `stack.c` with the following methods (as defined in `include/stack.h`) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   * create | 
					
						
							|  |  |  |   * push | 
					
						
							|  |  |  |   * pop | 
					
						
							|  |  |  |   * peek | 
					
						
							|  |  |  |   * length | 
					
						
							|  |  |  |   * destroy | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The underlying implementation may be | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   * dynamically-sized array | 
					
						
							|  |  |  |   * linked-list | 
					
						
							|  |  |  |   * any other ordered data structure | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The storage strategy may  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   * make copies of the original elements | 
					
						
							|  |  |  |   * store pointers to the original elements | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-16 09:33:43 -06:00
										 |  |  | The implementation must pass the following test suite `stack-test.c` | 
					
						
							| 
									
										
										
										
											2011-08-15 12:54:11 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-15 13:00:01 -06:00
										 |  |  |     tar xf stack.tar.gz -C ~/ | 
					
						
							| 
									
										
										
										
											2011-08-15 12:54:11 -06:00
										 |  |  |     cd ~/stack | 
					
						
							| 
									
										
										
										
											2011-08-15 13:00:01 -06:00
										 |  |  |     mkdir -p build | 
					
						
							| 
									
										
										
										
											2011-08-15 12:54:11 -06:00
										 |  |  |     cd build | 
					
						
							|  |  |  |     cmake ../ | 
					
						
							| 
									
										
										
										
											2011-08-15 13:00:01 -06:00
										 |  |  |     make | 
					
						
							| 
									
										
										
										
											2011-08-15 12:54:11 -06:00
										 |  |  |     ./stack-test | 
					
						
							| 
									
										
										
										
											2011-08-15 13:00:01 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | Prep | 
					
						
							|  |  |  | === | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     rm -rf stack/stack.c | 
					
						
							|  |  |  |     touch stack/stack.c | 
					
						
							|  |  |  |     tar czf stack.tar.gz stack/ |