- Type
- Quiz
- Course
- CS315 Network Security
- Size
- PDF 430 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2, 4 of 81. Download the file for all 81 pages.
CS315 Class Notes
Raphael Finkel
May 4, 2021
Intro
Class 1, 1/26/2021
- Handout 1 — My names
- TA: Patrick Shepherd
- Plagiarism — read aloud
- Assignments on web. Use C, C++, or Java.
- accounts in MultiLab
- text — we will skip around
Basic building blocks: Linked lists (Chapter 3)
and trees (Chapter 4)
Linked lists and trees are examples of data structures:
- way to represent information
- so it can be manipulated
- packaged with routines that do the manipulations
Leads to an Abstract Data Type (ADT): has an API (specification) and hides its internals.
- used as a part of several ADTs.
- Can be considered an ADT itself.
- Collection of nodes, each with optional arbitrary data and a pointer to the next element on the list.
create empty list O(1) insert new node at front of list O(1) delete first node, returning data O(1) count length O(n) search by data O(n) sort O(n log n) to O(n2)
Sample code (in C)
1 #define NULL 0
4 typedef struct node_s { int data; struct node_s *next; 7 } node;
9 node *makeNode(int data, node* next) { node *answer = (node *) malloc(sizeof(node));
Answer: >data = data;
Answer: >next = next;
14 } // makeNode
16 node *insertAtFront(node* handle, int data) { node *answer = makeNode(data, handle->next); handle->next = answer;
20 } // insertAtFront
22 node *searchDataIterative(node *handle, int data) {
node *current = handle->next; while (current != NULL) { if (current->data == data) break;
return current;
32 node *searchDataRecursive(node *handle, int data) { // recursive method node *current = handle->next; if (current == NULL) return NULL; else if (current->data == data) return current; else return searchDataRecursive(current, data); 38 } // searchDataRecursive
Related CS315 files
All CS315 files →Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.