Skip to content
VUBuddy

CS301 Midterm Notes Lectures 1-22

Data Structures PDF 4.2 MBUpdated 23 Oct 2026
Midterm past paper CS301 Midterm Notes Lectures 1-22 PDF 4.2 MB
vubuddy.com
Type
Midterm past paper
Course
CS301 Data Structures
Size
PDF 4.2 MB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 4.2 MB

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 125. Download the file for all 125 pages.

CS301 Mid term Notes

Lec 1 to 22

Data Structures Lecture No. 01

Data structures

Data structures are used to store data in a computer in an organized form. In C++ language, Different types of data structures are; Array, Stack Queue, Linked List, and Tree. Sorting technique is merge sort, shell sort, bubble sort, Quick sort, Selection sort, Heap sort etc.

Organizing Data

  •  Any organization for a collection of records that can be searched, processed in any order, or modified.
  •  The choice of data structure and algorithm can make the difference between a program running in a few seconds or many days.

Data Structures

Data Structures are a specialized means of organizing and storing data in computers in such a way that we can perform operations on the stored data more efficiently.

Most Common 8 Data structures are as follows:

  1. Arrays
  2. Linked Lists
  3. Stacks
  4. Queues
  5. Hash Tables
  6. Trees
  7. Heaps
  8. Graphs

Arrays

An ordered and index able sequence of values. C++ supports arrays of a single dimension (a vector) or of multiple dimensions. Elementary data structure that exists as built-in in most programming languages.

#include <iostream>

using namespace std;

main( int argc, char** argv )

int x[6];

int j;

for(j=0; j < 6; j++)

x[j] = 2*j;

Array operations

  1. Traverse: Go through the elements and print them.
  2. Search: Search for an element in the array. You can search the element by its value or its index.
  3. Update: Update the value of an existing element at a given index.

Inserting elements to an array and deleting elements from an array cannot be done straight away as arrays are fixed in size. If you want to insert an element to an array, first you will have to create a new array with increased size (current size +

  1. , copy the existing elements and add the new element. The same goes for the deletion with a new array of reduced size.

Applications of arrays

  •  Used as the building blocks to build other data structures such as array lists, heaps, hash tables, vectors and matrices.
  •  Used for different sorting algorithms such as insertion sort, quick sort, bubble sort and merge sort.

The LIST Data Structure

  •  The List is among the most generic of data structures.

Real life:

  1. shopping list,
  2. groceries list,
  3. list of people to invite to dinner
  4. List of presents to get

Lists LONG OR SHORT OR Quiz

  •  A list is collection of items that are all of the same type (grocery items, integers, names).
  •  The items, or elements of the list, are stored in some particular order.
  •  It is possible to insert new elements into various positions in the list and remove any element of the list.
  •  List is a set of elements in a linear order. For example, data values a1, a2, a3, a4 can be arranged in a list:

(a3, a1, a2, a4)

In this list, a3, is the first element, a1 is the second element, and so on

  •  The order is important here; this is not just a random collection of elements, it is an ordered collection.

List Operations FOR MCQ

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.