Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 848 pages
Exam (elaborations)

Data Structures and C Programming by Reema Thareja Study Guide Updated Latest 2026–2027 Data Structures C Programming Algorithms Linked Lists Trees Graphs Computer Science Exam Study Material for Students and Instructors.

Document preview thumbnail
Preview 4 out of 848 pages

Prepare confidently for computer science examinations with this comprehensive **Study Guide for Data Structures and C Programming by Reema Thareja**. Updated for the latest 2026–2027 academic period, this resource is designed to help students build a strong foundation in programming and data structures using the C programming language. The study guide covers C programming fundamentals, variables, data types, operators, control structures, functions, pointers, arrays, strings, structures, file handling, recursion, linked lists, stacks, queues, trees, binary search trees, heaps, graphs, hashing, sorting algorithms, searching algorithms, algorithm analysis, and problem-solving techniques. Ideal for quizzes, assignments, laboratory exercises, midterm examinations, final exams, and competitive programming preparation, this resource reinforces programming logic, strengthens algorithmic thinking, and enhances examination readiness while serving as an excellent companion for computer science, software engineering, information technology, and engineering students studying data structures and C programming.

Content preview

Notes on Data Structures and Programming
Y Y Y Y Y Y




Techniques (CPSC 223, Spring 2018) Y Y Y Y




James Aspnes Y




2018-05-02T12:03:35-0400


Contents

1 Course administration Y 13
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . .
Y Y 13 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . . .
Y Y Y




1.1.1 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.1.2 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.1.3 Documentation . . . . . . . . . . . . . . . . . . . . . . . . 14 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.1.4 Questions and comments . . . . . . . . . . . . . . . . . . 14 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.2 Lecture schedule . . . . . . . . . . . . . . . . . . . . . . . .
Y 15 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . .
Y Y




1.3 Syllabus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . . . 18 Y Y Y




1.3.1 On-line course information . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.2 Meeting times . . . . . . . . . . . . . . . . . . . . . . . . . 18 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.3 Synopsis of the course . . . . . . . . . . . . . . . . . . . . 19 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.4 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . 19 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.5 Textbook . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.6 Course requirements . . . . . . . . . . . . . . . . . . . . . 19 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.7 Staff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




.
1.3.7.1 Instructor . . . . . . . . . . . . . . . . . . . . . . 19 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.7.2 Teaching Fellow . . . . . . . . . . . . . . . . . . 20 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.7.3 Undergraduate Learning Assistants . . . . . . . 20 Y Y Y Y Y Y Y Y Y Y




1.3.8 Use of outside help . . . . . . . . . . . . . . . . . . . . . . 20
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.9 Clarifications for homework assignments . . . . . . . . . . 20 Y Y Y Y Y Y Y Y Y Y Y Y Y




1.3.101.4.2
LateWhyY
should you.learn
assignments . . about
Y. . . data
. . .structures
. . . . . and
. . program-
. . . . . . . 21 Y Y
Y
Y
Y Y Y
Y
Y Y Y
Y
Y Y
Y
Y Y Y Y Y
YY
Y
YY
Y Y Y Y Y Y




1.4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . .
Y Y




1.4.1 Why should you learn to program in C? . . . . . . . . . . 21 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




ming techniques? . . . . . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 22
. . Y




2 The Zoo Y 1 22
2.1 Getting an account . . . . . . . . . . . . . . . . . . . . . . . 23
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . .
Y Y




2.2 Getting into the room . . . . . . . . . . . . . . . . . . . . . . 23
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. .
Y

, 2.3 Remote use ................................................................................................. 23
Y




2.3.1 Termina access .............................................................................. 23
F Y




2.3.2 GUI access..................................................................................... 25
Y




2.3.3 GUI access using FastX ................................................................. 26
Y Y Y




2.4 Developing on your own machine ............................................................. 26
Y Y Y Y




2.4.1 Linux .............................................................................................. 26
2.4.2 OSX ................................................................................................ 27
2.4.3 Windows........................................................................................ 27
2.5 How to compile and run programs ............................................................ 27
Y Y Y Y Y




2.5.1 Creating the program ................................................................... 27
Y Y




2.5.2 Compiling and running a program ............................................... 28 Y Y Y Y




2.5.3 Some notes on what the program does ......................................... 29
Y Y Y Y Y Y




3 The Linux programming environment
Y Y 30 Y




3.1 The shell ..................................................................................................... 30
Y




3.1.1 Getting a shel prompt in the Zoo ................................................. 30
Y Y F Y Y Y Y




3.1.2 The Unix filesystem...................................................................... 30
Y Y




3.1.3 Unix command-line programs....................................................... 31
Y Y




3.1.4 Stopping and interrupting programs........................................... 32 Y Y Y




3.1.5 Running your own programs ........................................................ 33
Y Y Y




3.1.6 Redirecting input and output ....................................................... 33 Y Y Y




3.2 Text editors................................................................................................ 34
Y




3.2.1 Writing C programs with Emacs .................................................. 34
Y Y Y Y




3.2.1.1 My favorite Emacs commands ..................................... 34 Y Y Y




3.2.2 Using Vi instead of Emacs ............................................................ 35
Y Y Y Y




3.2.2.1 My favorite Vim commands ........................................ 36 Y Y Y




3.2.2.1.1 Norma mode .................................................. 36 F
Y




3.2.2.1.2 Insert mode .................................................... 37 Y




3.2.2.2 Settings .......................................................................... 37
3.3 Compilation tools ....................................................................................... 38
Y




3.3.1 The GNU C compiler gcc .............................................................. 38
Y Y Y Y




3.3.2 Make .............................................................................................. 38
3.3.2.1 Make gotchas................................................................. 40 Y




3.4 Debugging tools ......................................................................................... 40
Y




3.4.1 Debugging in general ....................................................................40 Y Y




3.4.2 Assertions ....................................................................................... 41
3.4.3 The GNU debugger gdb..................................................................41
Y Y Y




3.4.3.1 My favorite gdb commands ......................................... 44 Y Y Y




3.4.3.2 Debugging strategies .................................................... 45 Y




3.4.3.3 Common applications of gdb ........................................ 45 Y Y Y




3.4.3.3.1 Watching your program run .......................... 46 Y Y Y




3.4.3.3.2 Dealing with failed assertions ....................... 46 Y Y Y




3.4.3.3.3 Dealing with segmentation faults.................. 48 Y Y Y




3.4.3.3.4 Dealing with infinite loops ............................ 49 Y Y Y




3.4.3.3.5 Mysterious variable changes ......................... 49 Y Y




3.4.4 Valgrind ......................................................................................... 52


2

, 3.4.4.1 Compilation flags . . . . . . . . . . . . . . . . . 52 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.4.4.2 Automated testing . . . . . . . . . . . . . . . . . 53 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.4.4.3 Examples of some common valgrind errors . . . 53 Y Y Y Y Y Y Y Y




3.4.4.3.1 Uninitialized values . . . . . . . . . . . 53 Y Y Y Y Y Y Y Y Y Y Y Y




3.4.4.3.2 Bytes definitely lost . . . . . . . . . . . 54 Y Y Y Y Y Y Y Y Y Y Y Y Y




3.4.4.3.3 Invalid write or read operations . . . . 55 Y Y Y Y Y Y Y Y Y




3.4.5 Not recommended: debugging output . . . . . . . . . . . 57
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.5 Performance tuning . . . . . . . . . . . . . . . . . . . . . . .
Y 59 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . .
Y Y




3.5.1 Timing under Linux . . . . . . . . . . . . . . . . . . . . . 59
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.5.2 Profiling with valgrind . . . . . . . . . . . . . . . . . . . 60
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.5.3 Profiling with gprof . . . . . . . . . . . . . . . . . . . . . 66
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.5.3.1 Effect of optimization during compilation . . . . 73 Y Y Y Y Y Y Y Y




3.6 Version control . . . . . . . . . . . . . . . . . . . . . . . . . 75
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. . . 75 Y Y




3.6.1 Setting up Git . . . . . . . . . . . . . . . . . . . . . . . . 77
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.2 Editing files . . . . . . . . . . . . . . . . . . . . . . . . . .
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.3 Renaming files . . . . . . . . . . . . . . . . . . . . . . . . 78
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.4 Adding and removing files . . . . . . . . . . . . . . . . . . 79
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.5 Recovering files from the repository . . . . . . . . . . . . 79 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.6 Undoing bad commits . . . . . . . . . . . . . . . . . . . . 80
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.7 Looking at old versions . . . . . . . . . . . . . . . . . . . 81
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.6.8 More information about Git . . . . . . . . . . . . . . . . . 82
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




3.7 Submitting assignments . . . . . . . . . . . . . . . . . . . . . 82
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




. .
Y




4 The C programming language
Y Y Y 84
4.1 Structure of a C program . . . . . . . . . . . . . . . . . . . .
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 85
. .
Y




4.2 Numeric data types . . . . . . . . . . . . . . . . . . . . . . .
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 91
. . .
Y Y




4.2.1 Integer types in C . . . . . . . . . . . . . . . . . . . . . .
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 93
4.2.1.1 Basic integer types . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 93
4.2.1.2 C99 fixed-width types . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 95
4.2.2 size_t and ptrdiff_t . . . . . . . . . . . . . . . . . . .
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 97
4.2.2.1 Integer constants . . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 97
4.2.2.1.1 Naming constants . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y 98
4.2.2.2 Integer operators . . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 100
4.2.2.2.1 Arithmetic operators . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y 100
4.2.2.2.2 Bitwise operators . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y 101
4.2.2.2.3 Logica operators . . . . . . . . . . . . . F Y Y Y Y Y Y Y Y Y Y Y Y Y Y 103
4.2.2.2.4 Relationa operators . . . . . . . . . . . F Y Y Y Y Y Y Y Y Y Y Y Y 103
4.2.2.3 Converting to and from strings . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y 104
4.2.3 Floating-point types . . . . . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 105
4.2.3.1 Floating point basics . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 105
4.2.3.2 Floating-point constants . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y 105
4.2.3.3 Operators . . . . . . . . . . . . . . . . . . . . . . Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 106
4.2.3.4 Conversion to and from integer types . . . . . . Y Y Y Y Y Y Y Y Y Y Y 106

3

, 4.2.3.5 The IEEE-754 floating-point standard . . . . . . 107
Y Y Y Y Y Y Y Y Y




4.2.3.6 Error . . . . . . . . . . . . . . . . . . . . . . . . 108
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y




4.2.3.7 Reading and writing floating-point numbers . . . 109
Y Y Y Y Y Y Y




4

Connected book
 image
Reema Thareja Data Structures Using C
Edition: 2014 ISBN: 9780198099307 Edition: Unknown

Document information

Uploaded on
July 11, 2026
Number of pages
848
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$21.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
2
Followers
0
Items
408
Last sold
5 days ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions