All Flashcards
What is a list?
A collection of elements, ordered and mutable.
What is an index?
The position of an element within a list.
What is list traversal?
The process of accessing each element in a list.
What is appending?
Adding an element to the end of a list.
What is inserting?
Adding an element at a specific index in a list.
What is removing?
Deleting an element from a list.
What does len() do?
Returns the number of elements in a list.
What is linear search?
Checking each element one by one until the desired element is found.
What is a complete traversal?
Going through every single element in the list.
What is a partial traversal?
Going through only a part of the list.
What are the differences between append() and insert()?
append(): Adds to the end | insert(): Adds at a specific index.
What are the differences between for and while loops for list traversal?
for loop: Iterates through elements directly | while loop: Requires manual index management.
What are the differences between complete and partial traversal?
Complete: Visits all elements | Partial: Visits a subset of elements.
What are the differences between accessing and assigning list elements?
Accessing: Retrieves the value at an index | Assigning: Modifies the value at an index.
What are the differences between lists in Python and AP Pseudocode?
Python: Indexing starts at 0 | AP Pseudocode: Indexing starts at 1.
What are the differences between remove() and assigning None to a list element?
remove(): Changes the length of the list | Assigning None: Keeps the list length the same but replaces the element with None.
What are the differences between modifying a list in-place versus creating a new list?
In-place: Changes the original list | New list: Creates a copy with modifications, leaving the original unchanged.
What are the differences between a list and a string?
List: Mutable, can hold different data types | String: Immutable, holds characters only.
What are the differences between using a list and a set?
List: Ordered, allows duplicates | Set: Unordered, does not allow duplicates.
What are the differences between linear search and binary search?
Linear search: Works on unsorted lists, checks each element one by one | Binary search: Requires sorted list, divides search interval in half.
How are lists applied in real-world scenarios?
Storing a sequence of tasks, managing a playlist of songs, representing a deck of cards.
How is list traversal used in data analysis?
Iterating through data points to calculate statistics or identify patterns.
How are lists used in implementing stacks and queues?
Lists can be used as the underlying data structure for stacks (LIFO) and queues (FIFO).
How are lists used in game development?
Storing the positions of game objects, managing player inventories, and tracking game states.
How are lists used in web development?
Storing lists of users, items in a shopping cart, or search results.
How can lists be used to implement a simple database?
Each list can represent a table, with each element in the list representing a row or record.
How are lists used in machine learning?
Storing feature vectors, training data, and model parameters.
How are lists used in social media applications?
Storing lists of friends, posts, and comments.
How are lists used in recommendation systems?
Storing lists of recommended items based on user preferences.
How are lists used in operating systems?
Managing processes, storing file directories, and handling system calls.