Podcast
Questions and Answers
Qua esas la fundamentala karakterizivo di lineara tabelo?
Qua esas la fundamentala karakterizivo di lineara tabelo?
- Infiniteso di elementi kun diferanta tipi di datumi.
- Finiteso di elementi kun identika tipi di datumi. (correct)
- Finiteso di elementi kun diferanta tipi di datumi.
- Infiniteso di elementi kun identika tipi di datumi.
Se lineara tabelo esas vakua, qua esas la valoro di 'n', ube 'n' reprezentas la longeso dil tabelo?
Se lineara tabelo esas vakua, qua esas la valoro di 'n', ube 'n' reprezentas la longeso dil tabelo?
- n = 1
- n = 0 (correct)
- n > 0
- n = -1
Qua esas la rolo di ADT Lineara Tabelo?
Qua esas la rolo di ADT Lineara Tabelo?
- Ignoras la bezoni di bazala operaci.
- Restriktas l'uzo di certa operaci sur la tabelo.
- Definas datumi-strukturo per lua logikala strukturo e operaci. (correct)
- Definas datumi-strukturo nur per sua implemento.
Qua esas la maxim grava konsidero kande elektas inter diversa konservado-strukturi por lineara tabelo?
Qua esas la maxim grava konsidero kande elektas inter diversa konservado-strukturi por lineara tabelo?
Qua esas la funcino InitList(&L)
?
Qua esas la funcino InitList(&L)
?
Qua rezulto produktesas da operaco DestroyList(&L)
?
Qua rezulto produktesas da operaco DestroyList(&L)
?
Qua esas la reveno-valoro di la funciono ListEmpty(L)
?
Qua esas la reveno-valoro di la funciono ListEmpty(L)
?
Qua esas la reveno-valoro di ListLength(L)
?
Qua esas la reveno-valoro di ListLength(L)
?
Qua esas la skopo di operaco DispList(L)
?
Qua esas la skopo di operaco DispList(L)
?
Qua esas la funcino di GetElem(L, i, &e)
?
Qua esas la funcino di GetElem(L, i, &e)
?
Qua esas la reveno-valoro del operaco LocateElem(L, e)
?
Qua esas la reveno-valoro del operaco LocateElem(L, e)
?
Qua esas la rezulto di aplikar ListInsert(&L, i, e)
?
Qua esas la rezulto di aplikar ListInsert(&L, i, e)
?
Qua esas l'efekto di ListDelete(&L, i, &e)
?
Qua esas l'efekto di ListDelete(&L, i, &e)
?
Kom organizesas elementi en lineara tabelo uzante sequencala konservado?
Kom organizesas elementi en lineara tabelo uzante sequencala konservado?
Qua esas la sinifikado di "logikal ordino" relate sequencala konservado?
Qua esas la sinifikado di "logikal ordino" relate sequencala konservado?
Qua esas la funcino di 'length'-membro en la tipo-defino di lineara tabelo?
Qua esas la funcino di 'length'-membro en la tipo-defino di lineara tabelo?
En la dato-strukturo di sequencala tabelo, qua indikas la frazo: "Atenco: logikal sinso e fizikal sinso esas diferanta per 1"?
En la dato-strukturo di sequencala tabelo, qua indikas la frazo: "Atenco: logikal sinso e fizikal sinso esas diferanta per 1"?
Kande on kreas tabelo, qua skopo servas SqList *&L
en CreateList(SqList *&L, ElemType a[], int n)
?
Kande on kreas tabelo, qua skopo servas SqList *&L
en CreateList(SqList *&L, ElemType a[], int n)
?
Qua esas la funcino di lineo di kodo L=(SqList *)malloc(sizeof(SqList))
kande on kreas tabelo?
Qua esas la funcino di lineo di kodo L=(SqList *)malloc(sizeof(SqList))
kande on kreas tabelo?
En la funciono InitList(SqList *&L)
, qua efekto havas la atribuajo L->length=0
?
En la funciono InitList(SqList *&L)
, qua efekto havas la atribuajo L->length=0
?
Qua esas l'efekto di free(L)
en la funciono DestroyList(SqList *&L)
?
Qua esas l'efekto di free(L)
en la funciono DestroyList(SqList *&L)
?
En tabelo, qua indikas la kodo return(L->length==0)
en ListEmpty(SqList *L)
?
En tabelo, qua indikas la kodo return(L->length==0)
en ListEmpty(SqList *L)
?
En la funciono TabelloLongeso, qua indikas la kodo return(L->longeso)
En la funciono TabelloLongeso, qua indikas la kodo return(L->longeso)
Qua esas la primordialo prekayuzo ante imprimadar la kontenajo di lineara tabelo kun DispList(SqList *L)
?
Qua esas la primordialo prekayuzo ante imprimadar la kontenajo di lineara tabelo kun DispList(SqList *L)
?
Qua esas la signifikado dil algoritmo-komplexeso O(1)
por GetElement(L, i, &e)
en tabelo sinuso?
Qua esas la signifikado dil algoritmo-komplexeso O(1)
por GetElement(L, i, &e)
en tabelo sinuso?
Plurafoye dum LocateElement(L, ElemType e)
, qua esas la implico se la algoritmo atingas return 0
?
Plurafoye dum LocateElement(L, ElemType e)
, qua esas la implico se la algoritmo atingas return 0
?
Qua esas la konsekuenco dil manko di checkaji por korekto di parametro en ListInsert
?
Qua esas la konsekuenco dil manko di checkaji por korekto di parametro en ListInsert
?
Dum operaco ListInsert
, por qua motivo esas necese movar elementi ante inserir novan?
Dum operaco ListInsert
, por qua motivo esas necese movar elementi ante inserir novan?
Quale esas la nombro de movi en ListInsert
, kande la insertajo avenas a la maxim lasta loko?
Quale esas la nombro de movi en ListInsert
, kande la insertajo avenas a la maxim lasta loko?
Qua esas la algoritm-komplexeso en optimala okazioni en la operaco ListInsert
?
Qua esas la algoritm-komplexeso en optimala okazioni en la operaco ListInsert
?
Proque la delezeto en sinuso esas O(n)
por mezavalora tempo?
Proque la delezeto en sinuso esas O(n)
por mezavalora tempo?
Dum algoritmo desegno pro lineala tabelo per speciala prioritet por eficeco, qua esas rekomendes por konvertar?
Dum algoritmo desegno pro lineala tabelo per speciala prioritet por eficeco, qua esas rekomendes por konvertar?
Quala estas la komplikeco de tempo se la operaco de movado devas esti unufoje en la sinuso-tablo?
Quala estas la komplikeco de tempo se la operaco de movado devas esti unufoje en la sinuso-tablo?
Preimagine se vi havas lernanto datumo konservata tra sinuso-tablo, qual qual esas la maxim raciona approĉo pro subtenar kaj la organizon kaj la eficeco?
Preimagine se vi havas lernanto datumo konservata tra sinuso-tablo, qual qual esas la maxim raciona approĉo pro subtenar kaj la organizon kaj la eficeco?
Qual esas utiligata la rekonstruko pro senigas datumo kun partikulara valoro ' x ' de sinusa tablo ' A ' ?
Qual esas utiligata la rekonstruko pro senigas datumo kun partikulara valoro ' x ' de sinusa tablo ' A ' ?
Qual esas mova metodo per seniganta 'x' valorojn desde tablon, quante estas influitita per la komencuma nombroj des 'x's trovitaja?
Qual esas mova metodo per seniganta 'x' valorojn desde tablon, quante estas influitita per la komencuma nombroj des 'x's trovitaja?
En metodo per partisionar kaj ordigas sinuson-tablon 'L' kun rigardante al pioniro, qual esas la celo?
En metodo per partisionar kaj ordigas sinuson-tablon 'L' kun rigardante al pioniro, qual esas la celo?
Qual es la plus grande diferenteco inter soluciono kun mova metodo kaj kun interŝanĝiga metodo pro reordinigo sinuso tablon?
Qual es la plus grande diferenteco inter soluciono kun mova metodo kaj kun interŝanĝiga metodo pro reordinigo sinuso tablon?
Kio est as pro gajnanta datuma maniero post faro sinuso tablo laboro-surloke ?
Kio est as pro gajnanta datuma maniero post faro sinuso tablo laboro-surloke ?
Flashcards
Quale definas lineara tabelo?
Quale definas lineara tabelo?
Lineara tabelo esas finita sequo de datal elementi kun sama traito.
Quo esas la longeso di lineara tabelo?
Quo esas la longeso di lineara tabelo?
La nombro de elementi en lineara tabelo.
Quo esas InitList(&L)?
Quo esas InitList(&L)?
Konstruktir vakua lineara tabelo.
Quo esas DestroyList(&L)?
Quo esas DestroyList(&L)?
Signup and view all the flashcards
Quo esas ListEmpty(L)?
Quo esas ListEmpty(L)?
Signup and view all the flashcards
Quo esas ListLength(L)?
Quo esas ListLength(L)?
Signup and view all the flashcards
Quo esas DispList(L)?
Quo esas DispList(L)?
Signup and view all the flashcards
Quo esas GetElem(L, i, &e)?
Quo esas GetElem(L, i, &e)?
Signup and view all the flashcards
Quo esas LocateElem(L, e)?
Quo esas LocateElem(L, e)?
Signup and view all the flashcards
Quo esas ListInsert(&L, i, e)?
Quo esas ListInsert(&L, i, e)?
Signup and view all the flashcards
Quo esas ListDelete(&L, i, &e)?
Quo esas ListDelete(&L, i, &e)?
Signup and view all the flashcards
Quo esas lineara tabelo ADT?
Quo esas lineara tabelo ADT?
Signup and view all the flashcards
Quo esas sequencala konservado?
Quo esas sequencala konservado?
Signup and view all the flashcards
Quale laboresas sequencala konservado?
Quale laboresas sequencala konservado?
Signup and view all the flashcards
Quo esas typedef struct?
Quo esas typedef struct?
Signup and view all the flashcards
Quo esas CreateList(SqList *&L, ElemType a[], int n)?
Quo esas CreateList(SqList *&L, ElemType a[], int n)?
Signup and view all the flashcards
Quo esas libera (L)?
Quo esas libera (L)?
Signup and view all the flashcards
Quo esas LocateElem (SqList *L, ElemType e)?
Quo esas LocateElem (SqList *L, ElemType e)?
Signup and view all the flashcards
Quo esas bool ListInsert (SqList *&L, int i, ElemType e)?
Quo esas bool ListInsert (SqList *&L, int i, ElemType e)?
Signup and view all the flashcards
Quo esas bool ListDelete(SqList *&L, int i, ElemType &e)?
Quo esas bool ListDelete(SqList *&L, int i, ElemType &e)?
Signup and view all the flashcards
Quale esas bona algoritmo?
Quale esas bona algoritmo?
Signup and view all the flashcards
Quale esas lenta algoritmo?
Quale esas lenta algoritmo?
Signup and view all the flashcards
Quo esas move1?
Quo esas move1?
Signup and view all the flashcards
Quo esas move2?
Quo esas move2?
Signup and view all the flashcards
Study Notes
- Chapter 2 studies linear lists
2.1 Basic Concepts of Linear Lists
- A linear list is a limited sequence of data elements with the same characteristics.
- The same characteristics: all elements belong to the same data type.
- Limited: the number of data elements is limited.
- Sequence: data elements are uniquely determined by the logical sequence number. A linear list can have elements with the same value.
- The number of elements contained in a linear list is length, indicated by n, where n≥0.
- When n=0, the linear list is an empty list, that is, the table does not contain any elements.
- The logical representation is (a1, a2,..., ai, ai+1,..., an).
- ai (1≤i≤n) shows the i-th (i indicates the logical position) element
2.1.2 Linear List Operations
- InitList(&L): Constructs an empty linear list L.
- DestroyList(&L): Frees the memory space occupied by the linear list L.
- ListEmpty(L): Returns true if L is an empty list, false otherwise.
- ListLength(L): Returns the number of elements n in L.
- DispList(L): Sequentially displays the domain of values of each node in L when the linear list L is not empty.
- GetElem(L, i, &e): Returns the value of the i-th (1≤i≤n) element in L using e.
- LocateElem(L, e): Returns the logical position of the first value domain equal to e in L; if such an element does not exist, returns 0.
- ListInsert(&L, i, e): Inserts a new element e before the i-th (1≤i≤n) element in L; the length of L is increased by 1.
- ListDelete(&L, i, &e): Deletes the i-th (1≤i≤n) element in L and returns its value with e; the length of L is decreased by 1.
- Programmers can directly use it to store data as a container for storing data.
- Programmers can directly use its basic operations to accomplish more complex functions.
- ADT for linear lists includes linear list ADT = logical structure + basic operations (operation description)
2.2 Sequential Storage Structure of Linear Lists
- Store all elements in the linear list with a sequential storage method, storing sequentially in a contiguous storage space in memory. Data member stores elements, length stores the sequence's actual length.
- Logical and physical positions differ by 1.
2.2.2 Implementation of Sequence List Operations
-
To create a sequence list, a[0..n-1] creates a sequence list L as a whole
-
Function prototype is
void CreateList(SqList *&L, ElemType a[], int n)
-
Sequence list pointed is passed by pointer.
-
To initialize a sequence list, this operation constructs an empty sequence list L with the member length set to 0.
-
To destroy a sequence list, this operation frees the memory space occupied by the linear list L via function
void DestroyList(SqList *&L)
-
To determine if a list is empty, this operation returns returns true if L is an empty sequence list, false if it is not via the function
bool ListEmpty(SqList *L)
-
To retrieves the length of a linear list via function
int ListLength(SqList *L)
, this operation returns the length of the sequence list L, it simply returns the length member's value. -
To output a linear list, via the function
void DispList(SqList *L)
, this operation displays the value of each element in L when the sequence list L is not empty. -
Retrieves the value of a data element at a certain point, via the function
bool GetElem(SqList *L, int i, ElemType &e)
, this operation returns the value of the i-th (1≤i≤ListLength(L)) element in L and stores it in e. -
With O(1) complexity, it embodies the random access feature.
-
When locating an element's value using
int LocateElem(SqList *L, ElemType e)
, it searches through via the sequential order, starting from the 1st value, the logical order of the element that equals e; Returns value is 0. -
To insert data, using
bool ListInsert(SqList *&L, int i, ElemType e)
the operation inserts the element, e. -
The time complexity of moving existing elements is relevant to the list
L->length
and insert position 'i' -
When i = n+1, the number of moves = 0
-
When i = 1, the number of moves = n (max value)
-
Best time complexity is O(1)
-
The worst algorithms time complexity is O(n)
-
When deletion is performed using
bool ListDelete(SqList *&L , int i, ElemType &e)
, this operation deletes the i-th (1 ≤ i ≤ ListLength(L)) element of the sequential list L. -
When i = n, the number of moves is 0
-
When i=1, the number of moves will be n-1.
-
The best time complexity for the deletion algotithm = 0(1)
-
The worst time complexity = 0(n)
-
When performing list algorithm design, take note that the data should be stored with sequence list storage and use the fundamental sequence table to complete tasks.
Example Algorithms
-
Given a list of length
n
, design an algorithm with time complexity of 'O(n) and space complexity of 'O(1) to remove all elements in the list of value, 'x'. -
A solution requires moving all elements, resulting in 'O(n*n) time complexity with space complexity unaffected!
-
Alternatively moving all non-'x' valued elements creates 'O(n)' Space & time complexity!
-
Solution Remove all values equal to "x", with
k
tracking elements.- Implementation is akin to re-establishing the sequence!
-
A secondary solution using
k
tracks a number of elements equal tox
during the A-scan and statistic collection, and uses this shift nonx
terms. -
Given list with 10 intergers, take the 1st as the median, with all smaller or equal to, to the left, and the greater elements to it's right
-
pivot = 'L' -> data[0] uses
0 - 9
scan for less than values & greater values while exchanging elements!- Function is
void move1(SqList *&L)
- Function is
-
Alternatively pivots can be moved to front or behind
pivot = 'L' -> data[0]
via Function 'void move2(SqList '&L')' and while the algorithm scales in 'O(n)', the first method is preferred due to fewer record moves overall!
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.