ArrayListIterator Solution

$30.00 $24.90

Description

Adapt the code for LinkedListIterator to create a ArrayListIterator for ArrayList.

  1. Create a new project in your IDE with a ‘src’ source directory.

  2. Copy in “array_list.c” and “array_list.h” from yours or the instructor’s assignment-1 GitHub repository.

  3. Copy in “linked_list_iterator.c”, “linked_list_iterator.h”, and “linked_list_iterator_main.c” from the lecture-4 GitHub repository as a starting point, and rename these files “array_list_iterator.c”, “array_list_iterator.h”, and “array_list_iterator_main.c”

  4. Replace all occurrances of LinkedList in “arraylist_iterator.h”, “arraylist_iterator.c”, and “array_list_iterator_main.c” with “”ArrayList”. and any occurrances of “linked list” to “array list”.

  5. Modify the ArrayListIterator struct to replace curNode with a curIndex as the index of the current node in the iteration.

  6. Reimplement the functions in “array_list_iterator.c” to work with the ArrayList representation of the list. Since there is no “dummy node” you may want to use an “post-increment” style for forward iteration that fetches the value and increments the index, and a “pre-increment” style for backward iteration that decrements the index and fetches the value.

  7. Modify “arraylist_iterator_main.c” as required. The program should produce the same output as for the LinkedListIterator.

ArrayListCrawler

Adapt the code for LinkedListCrawler to create a ArrayListCrawler for ArrayList.

  1. Copy in “linked_list_crawler.c” and “linked_list_crawler.h” from the lecture-5 GitHub repository as a starting point, and rename these files “array_list_crawler.c” and “array_list_crawler.h”.

  2. Replace all occurrances of LinkedList with ArrayList and any occurrences of “linked list” with “array list” in “array_list_crawler.c” and “array_list_crawler.h”.

  3. Make any other changes required to “array_list_crawler.c” required to use ArrayList and ArrayListIterator.

  4. Add the the testLinkedListCrawler() function and the various crawler callback functions from “linked_list_crawler_main.c” to “arraylist_iterator_main.c”, and make the appropriate changes to test the new ArrayListCrawler. Call the new function testArrayListCrawler() from main() following the call totestArrayListIterator().