Skip to content
VUBuddy

CS301 Midterm Short Notes 2021 Set 2

Data Structures PDF 325 KBUpdated 23 Oct 2026
Midterm past paper CS301 Midterm Short Notes 2021 Set 2 PDF 325 KB
vubuddy.com
Type
Midterm past paper
Course
CS301 Data Structures
Size
PDF 325 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 325 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2, 3 of 6. Download the file for all 6 pages.

CS301- Short Notes for Midterm Exams 2021

Linked List

  1. LInked List Low-level data structure
  •  Represent a sequence of nodes that have pointers to other nodes.
  1. 3 basic kinds of linked list Singly Linked List

Circular Linked List

  1. Head No matter how many nodes are present in the linked list, the very first node is called head
  2. Tail The last node is called the tail. If there is just one node created then it is called both head and tail.
  3. Singly Linked List In this list, the nodes each have one pointer to the next node
  4. doubly-linked list In a doubly-linked list contains some data, a link to the next node and a link to the previous node.

Q7. A node in Singly Linked List contains what?

Value Next Pointer

  1. In a linked list

The first node is ... ? The last node is ... ? The first node is Head The last node is Tail

Q9. How do we keep the connection to a linked list?

By a variable pointing to the head

  1. Simple Pseudo code of Singly LinkedListNode public class LinkedListNode {

public int value; public LinkedListNode next;

public LinkedListNode(int value) { this.value = value;

We could build a singly linked list like this:

LinkedListNode a = new LinkedListNode(5); LinkedListNode b = new LinkedListNode(1); LinkedListNode c = new LinkedListNode(9);

a.next = b; b.next = c;

  1. Simple Pseudo code of Doubly LinkedListNode

public class LinkedListNode {

public int value; public LinkedListNode next; public LinkedListNode previous;

public LinkedListNode(int value) { this.value = value;

So we could build a doubly linked list like this:

LinkedListNode a = new LinkedListNode(5); LinkedListNode b = new LinkedListNode(1); LinkedListNode c = new LinkedListNode(9);

// put b after a a.next = b; b.previous = a; // put c after b b.next = c; c.previous = b;

  1. Time Complexity for Insert /remove from the front
  •  Constant

Q13. Constant Time to insert/remove from the back is when?

Tail and Doubly LInked List

Q14. Constant Time to insert between node when?

ADT and Stack

  1. Abstraction Representation of an entity with only it's most relevant attributes.
  2. Encapsulation Having modules whose state is accessed through its methods only.
  3. Implementation Code written in methods
  4. Data Hiding Decoupling implementation from interface. -Make all fields private except methods that others will use ( hide state and make interface available) Advantage : Low Coupling (Implementation can change without affecting others)
  5. Encapsulation Modularity + Data Hiding
  6. Modularity Keep implementation and state in one module (class) Advantage: High Cohesion (Everything associated with the call is together)
  7. Abstract Data Types (ADT) a data type with values and operations that are not defined in the language by default.
  8. Data Structure A programming construct used to implement ADTs. -Mechanism for organizing the data that is the ADT is encapsulating -Data structures should be hidden by the API(methods) of the ADT
  9. Stack A Stack is a Last In First Out (LIFO) data structure. It supports two basic operations called push and pop. The push operation adds an element at the top of the stack, and the pop operation removes an element from the top of the stack. The Stack class extends Vector which implements the List interface.

Queues

Q1. What is a queue?

An ADT with FIFO characteristics

Q2. What does FIFO stand for?

First In First Out

  1. Where does insertion occur in a queue
  •  The rear
All CS301 files →
CS301 Data Structures All CS301 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.