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
Exam (elaborations)

DATA STRUCTURES AND ALGORITHMS PYTHON EXAM QUESTIONS AND ANSWERS | VERIFIED ANSWERS

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
28-07-2025
Written in
2024/2025

DATA STRUCTURES AND ALGORITHMS PYTHON EXAM QUESTIONS AND ANSWERS | VERIFIED ANSWERS

Institution
DATA STRUCTURES
Course
DATA STRUCTURES

Content preview

DATA STRUCTURES AND
ALGORITHMS PYTHON

Name Every Data Structure (There are 8 Main Ones) - Correct Answers -1. Array
2. Stack
3. Queue
4. Linked Lists
5. Hash Table
6. BST
7. B-Tree, Red Black Trees
8. Heaps

Name Every Python Super Basic Datastructure - Correct Answers -1. List
2. Tuples
3. Sets
4. Strings
5. Arrays (you must use numpy)

Strings - Correct Answers -1. They are immutable
2. Access characters in strings like you do for arrays/lists
3. empty strings are false, non empty are true.
4. | and & don't work on strings

Slicing - Correct Answers -string_name[beginning:end:step]
*end is not inclusive
*works for strings, lists, and tuples

Useful String Methods - Correct Answers -1. s[3]
2. s + t
3. len(s)
4. s in t
5. s.strip()
6. s.startswith(prefix)
7. s.endswith(suffix)
8. s.find(substring, beg, end) - returns the first position where substring is found.
9. s.rfind(substring, beg,end) - returns the position of the last occurrence of string
10. s.lower() - changes case
11. s.upper() - changes case
12. s.swapcase() - changes to other case

Python List - Correct Answers -1. not always homogenous
2. mutable

, 3. used to implement stacks and queues
Runtime and Space-Time of Selection Sort - Correct Answers -Runtime: theta(N^2)
Space-Time: Big O(1)

Runtime and Space-Time of Heap Sort - Correct Answers -Runtime: Omega(N) if all
elements are equal, Big O(NlogN)
Space-Time: Theta(N)

Runtime and Space-Time of In-place Heap Sort - Correct Answers -Runtime: O(NlogN)
Space-Time: Theta(1)

Python List Methods - Correct Answers -1. append(x)
2. extend(x)
3. insert(i, x)
4. min(list)
5. max(list)
6. del a[i:j]
7. a.reverse()
8. a.sort()
9. B = copy.deepcopy(A)
10. b = copy.copy(A)
11. remove(index)

Tuples - Correct Answers -1. collection of python objects separated by commas
2. immutable
3. use () to create

Tuples Methods - Correct Answers -1. len(tuple_name)
2. tuple(list_name)
3. cmp() - returns 0 if matched. 1 when not matched and longer, -1 when not matched
and shorter
4. max() - returns max el
5. min() - returns min el

Python Sets - Correct Answers -1. unordered collection data type that is iterable,
mutable, and has no duplicate elements
2. based on datastructure known as hash table
3. highly optimized for checking contains
4. to create a set you need to use set(list)
*Only instances of immutable types can be added to python set

Methods - Correct Answers -1. add(x)
2. union(other)
3. intersect(other)
4. difference(other)
5. clear()

Written for

Institution
DATA STRUCTURES
Course
DATA STRUCTURES

Document information

Uploaded on
July 28, 2025
Number of pages
7
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$12.99
Get access to the full document:

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

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
millyphilip West Virginia University
Follow You need to be logged in order to follow users or courses
Sold
2921
Member since
4 year
Number of followers
1958
Documents
44307
Last sold
14 hours ago
white orchid store

EXCELLENCY IN ACCADEMIC MATERIALS ie exams, study guides, testbanks ,case, case study etc

3.6

551 reviews

5
239
4
87
3
104
2
32
1
89

Recently viewed by you

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