Contents
Chapter 7 · Data Structure and AlgorithmPractice

LEARN WITH HARU

Video Lesson တွေက Haru အတန်းသားတွေအတွက်ပါ

Haru ရဲ့ ITPEC FE Full Course မှာ ယခု သင်ခန်းစာတွေကို တစ်ခုချင်း တစ်ကြောင်းချင်း အသေးစိတ်ရှင််ရှင်းပြထားပါတယ်

အခြေခံ မရှိတဲ့ ကျောင်းသားများစွာဟာလည်း ဒီ Course နဲ့ ပဲ အောင်မြင်ကုန်ကြပါပြီ

အတန်းမအပ်သေးပဲ Haru ဆီမှာ အစမ်းသင်ကြည့်ချင်ပါသလား?

သင်တန်းသားတွေရဲ့ စကားသံများ

သင်တန်းသားတွေရဲ့ စကားသံများ
Practice related questions (18)Progress & bookmarks

Current section

1 Data Structure

p. 403

Practice this section 18 linked exam questions with default filters

Progress

Not marked complete

Progress and bookmarks

p. 403 · PDF 413

1 Data Structure

For processing data in a computer, it is necessary to give instructions with a program. At that time, if the way to handle the data is predetermined according to the process, the efficiency is increased. This section explains data structure, which is the format of recording data.

1 - 1 Array

Array is a data structure that is used when a set of data using the same format is handled in a consolidated manner. Every a single data item (i.e., element) is distinguished with a number (a subscript or an index).

[Notation system of array elements]

  • • Index may start from 0 or 1. This textbook uses the notation that starts from 1 in
    consideration of the ease of understanding.
  • • Index can be enclosed with ( ), [ ], and so on. This textbook uses ( ).
Original Data Structure layout, PDF 413; original source comparison.
Enlarge original visual
Original source text
Example 1: Without using an array, make 
Example 2: Using an array, make the score
the score of three subjects 0.
of three subjects 0.
<Process>
<Process>
1) 0 → English
1) 0 → Score(1)
2) 0 → Japanese
2) 0 → Score(2)
3) 0 → Mathematics
3) 0 → Score(3)
Source visual description

Original Data Structure source layout. Source labels: Example 1: Without using an array, make; the score of three subjects 0.; <Process>; 1) 0 → English; 2) 0 → Japanese.

The advantage of using an array is that when the same process is performed on multiple data items, the process can be described by just changing the value of the index. For example, in the process of example 2, by representing the index with variable I, it can be described as follows:

Original Data Structure layout, PDF 413; original source comparison.
Enlarge original visual
Original source text
Repeat the following process while variable I is changed from 1 through 3. 
0 → Score(I)
Source visual description

Original Data Structure source layout. Source labels: Repeat the following process while variable I is changed from 1 through 3.; 0 → Score(I).

In this manner, when a data structure is used, the processing sequence can easily be

p. 404 · PDF 414

represented. In this example, there may not seem a big difference because there are fewer process targets (i.e., three subjects). However, for larger volumes of data (e.g., 20 subjects), the user may understand how efficient it is.

(1) One-dimensional array

One-dimensional array is a data structure that handles a set of data in the same format by arranging it in a row. “Array” generally refers to a one-dimensional array.

Original Data Structure layout, PDF 414; original source comparison.
Enlarge original visual
Original source text
Example: A one-dimensional array that records the results (i.e., scores) of exams in four 
subjects
Source visual description

Original Data Structure source layout. Source labels: Example: A one-dimensional array that records the results (i.e., scores) of exams in four; subjects.

(2) Multidimensional array

Multidimensional array is a data structure that handles array elements with multiple relations. For example, a two-dimensional array handles elements with two relations, namely, horizontal and vertical. Therefore, it requires multiple indexes for specifying elements. (The number of indexes is the same as the number of dimensions.)

Original Data Structure layout, PDF 414; original source comparison.
Enlarge original visual
Original source text
Example: A two-dimensional array that records the results (i.e., scores) of three persons 
who took exams in four subjects
Source visual description

Original Data Structure source layout. Source labels: Example: A two-dimensional array that records the results (i.e., scores) of three persons; who took exams in four subjects.

(3) Structured array

Structured array is a data structure where array elements are a set of data of different formats. It is also called record array because it has the same concept as records that are stored in a file.

Example: A structured array that records examinee’s number, name, and total score of three examinees

p. 405 · PDF 415

Original Data Structure layout, PDF 415; original source comparison.
Enlarge original visual
Source visual description

Original Data Structure source layout. Source labels: .

A general array is stored with the fixed number of elements in contiguous areas of memory (main memory). This is called static array. However, some programming languages support dynamic array where the number of array elements can be varied during the process. In addition, an array is an index based data structure that can be accessed directly, and therefore, it is also used as a hash table where storage location (i.e., index) is determined from the data to be stored. As the methods of determining storage location (i.e., index), division method, superposition method, and radix conversion method can be applied, which are used when the record address is calculated from the record key of a direct organization file. (A dedicated hash function can also be used.) Here, it is also necessary to consider the way of handling synonyms.

Section progress

Original chapter exercises

Original chapter exercises →

New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015