Sie sind auf Seite 1von 3

Introduction to Data Structures

Data Structure is a way of collecting and organizing data in such a way that we can perform
operations on these data in an effective way. Data Structures is about rendering data elements in
terms of some relationship, for better organization and storage. For example, we have data
player's name "Waqar" and age 36. Here "Waqar" is of String data type and 36 is of integer data
type.
We can organize this data as a record like Player record. Now we can collect and store player's
records in a file or database as a data structure. For example: "Akram" 40, "Miandad" 43,
"Inzimam" 41
In simple language, Data Structures are structures programmed to store ordered data, so that
various operations can be performed on it easily.

Algorithm
Step by step procedure designed to perform an operation, and which (like a map or flowchart) will
lead to the sought result if followed correctly. Algorithms have a definite beginning and a definite
end, and a finite number of steps. An algorithm produces the same output information given the
same input information, and several short algorithms can be combined to perform complex tasks
such as writing a computer program. A cookbook recipe, a diagnosis, a problem solving routine,
are some common examples of simple algorithms. Suitable for solving structured problems
(amenable to sequential analysis) algorithms are, however, unsuitable for problems where value
judgments are required.

Logic

The term "logic" refers to the science that studies the principles of correct reasoning. Logic requires
the act of reasoning by humans in order to form thoughts and opinions, as well as classifications
and judgments. The foundation of a logical argument is its proposition, or statement. The
proposition is either accurate (true) or not accurate (false). The argument is then built on premises.
The premises are the propositions used to build the argument. Then an inference is made from the
premises. Finally, a conclusion is drawn.
Understanding Logic Through Examples
There are two types of logical arguments - deductive and inductive. Examples of these are:
Deductive This type of reasoning provides complete evidence of the truth of its conclusion. It
uses a specific and accurate premise that leads to a specific and accurate conclusion. With correct
premises, the conclusion to this type of argument is verifiable and correct.
Inductive - This type of reasoning is "bottom up," meaning that it takes specific information and
makes a broad generalization that is considered probable, allowing for the fact that the conclusion
may not be accurate. This type of reasoning usually involves a rule being established based on a
series of repeated experiences.
Examples of Deductive and Inductive Logic
Deductive Logic
All squares are rectangles. All rectangles have four sides. Logic, therefore, tells you that all
squares have four sides.
It is dangerous to drive when it is snowing. It is snowing now. Logic tells you that it would be
dangerous to drive right now.
All dogs have a good sense of smell. Bailey is a dog. Therefore, deductive reasoning logic tells you
that Bailey has a good sense of smell.
All seniors are bad drivers. Mr. Jones is 70 years old and you won't let him drive your car because
you think he is an unsafe driver.
When it rains the trees get wet. The trees are wet this morning, so it rained last night.
All trees have trunks. An oak tree is a tree. Therefore, deductive reasoning tells you that the oak
tree has a trunk.
Inductive Logic
An umbrella prevents you from getting wet in the rain. Ashley took her umbrella and she did not get
wet. In this case, you could use inductive reasoning to offer an opinion that it was probably raining.
Your concluson, however, would not necessarily be accurate because Ashley would have remained
dry whether it rained and she had an umbrella, or whether it did not rain at all.
Every three year old you see at the park every afternoon spends most of their time crying and
screaming. Your conclusion is that all three year olds spend their afternoon screaming.
Every house that burned down on the block was caused by faulty wiring. You conclusion is that all
homes on the block have faulty wiring.
Red lights prevent accidents. Mike did not have an accident, therefore Mike stopped at a red light.
This is an example of inductive reasoning; but, it is faulty reasoning because Mike might not have

encountered any traffic signals at all. Therefore, he might have been able to avoid accidents even
without stopping at a red light.