Tuesday, October 4, 2011

.::VULMSIT::.eNoxel Vu old handouts (half price)

if any one need handouts of bscs (1 to 8 smster) on half price then
contact this number 03314804040

--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk

http://itncs.tk


You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

.::VULMSIT::.eNoxel email engine coding help

AOA 
i need to know that if any body are doing coding for email moderation engine ,then tell me which tool n language are using,and give me the idea ,that how can i start coding .

--

Khalid Humayun
MCS 4th semester
Tender-Hearted


--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

[~>VU-P!nD!<~] Re: [virtualposition] CS619 latest announcement

plz help how i reduce the monthly fee

--
You received this message because you are subscribed to the Google
Groups "vupindi" group.
To post to this group, send email to vupindi@googlegroups.com
To unsubscribe from this group, send email to
vupindi+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vupindi?hl=en

.::VULMSIT::.eNoxel CS619 latest announcement

Dear Students
Read latest announcement from CS619.

It is to inform you about the assignments interface on VULMS. All the students who are registering in the project for the first time in Fall 2011
Semester should ignore the assignments interface on VULMS.

The submission method is already explained in this file. After the completion of project and groups, you will get further information about
starting the project from same announcements page.

Remember Me in Your Prayers

Best regard's
Ch. Muhammad Afaaq (Arrien)

MBA (Finance) 
Islamabad
Afaaq_Tariq@yahoo.com

0346-5329264

For latest assignments solved quizzes files GDB, Solve & Unsolved Past Papers come join us in

http://www.vubaba.com

http://groups.google.com/group/vustudymania

If u like me than raise your hand with me
If not then raise ur standard
That's about me … !


--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

[~>VU-P!nD!<~] CS619 latest announcement

Dear Students
Read latest announcement from CS619.

It is to inform you about the assignments interface on VULMS. All the students who are registering in the project for the first time in Fall 2011
Semester should ignore the assignments interface on VULMS.

The submission method is already explained in this file. After the completion of project and groups, you will get further information about
starting the project from same announcements page.

Remember Me in Your Prayers

Best regard's
Ch. Muhammad Afaaq (Arrien)

MBA (Finance) 
Islamabad
Afaaq_Tariq@yahoo.com

0346-5329264

For latest assignments solved quizzes files GDB, Solve & Unsolved Past Papers come join us in

http://www.vubaba.com

http://groups.google.com/group/vustudymania

If u like me than raise your hand with me
If not then raise ur standard
That's about me … !


--
You received this message because you are subscribed to the Google
Groups "vupindi" group.
To post to this group, send email to vupindi@googlegroups.com
To unsubscribe from this group, send email to
vupindi+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vupindi?hl=en

.::VULMSIT::.eNoxel Who Says k '''Ghareeb, Ghareeb sy Ghareeb Tar Hota Ja Raha Hy'''?????


--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

|||▒░||||Virtualians|||░▒||| Height of Confidence !



خودی پہ مان اتنا ہے، کبھی مڑ کر نہیں دیکھا

جسے کہہ دوں کہ میرا ہے، اسے ہونا ہی پڑتا ہے


--
Silent Noise 
 sillysensitive (at)gmail.com
MBA
 4th (Finance) 
Faisalabad  (VFSD01 Civil Line)

--
For online discussion forums and inclusive portal about exam related data,Fun ,poetry,fashion,etc please visit www.virtualians.net
 
www.virtualians.net
study with moj masti

Virtulians Group Basic Posting Rules

Unethical comments, abuses are strictly prohibited you are expected to be polite while posting the messages
Messages containing Phone Numbers are treated as spam
Posting links of other sites or groups is not allowed

..::VU-Pink::.. Height of Confidence !



خودی پہ مان اتنا ہے، کبھی مڑ کر نہیں دیکھا

جسے کہہ دوں کہ میرا ہے، اسے ہونا ہی پڑتا ہے


--
Silent Noise 
 sillysensitive (at)gmail.com
MBA
 4th (Finance) 
Faisalabad  (VFSD01 Civil Line)

--
...:::Group Rules:::...
http://groups.google.com.pk/group/vu-pink/web/group-rules
^^^^^^
You received this message because you are subscribed to the Google
Groups "vu pink" group.
To post to this group, send email to vu-pink@googlegroups.com
To unsubscribe from this group, send email to
vu-pink+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com.pk/group/vu-pink?hl=en

[Blue Heaven] Height of Confidence !



خودی پہ مان اتنا ہے، کبھی مڑ کر نہیں دیکھا

جسے کہہ دوں کہ میرا ہے، اسے ہونا ہی پڑتا ہے


--
Silent Noise 
 sillysensitive (at)gmail.com
MBA
 4th (Finance) 
Faisalabad  (VFSD01 Civil Line)

--
███████████████{ Follow The Group Rules }██████████████████
 
We make a Blue Heaven Group On Face Book. it is so excited and pleasure for us that if you join This Pak youth community Place.
 
http://www.facebook.com/groups/149985251751375/
 
You received this message because you are subscribed to the Google
Groups "Blue Heaven" group.
To post to this group, send email to blue_heaven@googlegroups.com
To unsubscribe from this group, send email to
blue_heaven+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/blue_heaven?hl=en_US?hl=en

.::VULMSIT::.eNoxel ~~ Names of ALLAH ~~



--

 VIRTUAL UNIVERSITY STUDY GROUPS

    ********* CoooL Vu Students********           
    visit this group             join this group   

     *********** Vuhelp4u ************              
       visit this group              join this group                                  
                               

ISLAMIC INFORMATIVE DISCUSSION GROUP

    ********* Islamic Wisdom *********           
    visit this group               join this group        


Phr Yaad-e-Khuda Se Ghafil Iss Duniya Ki Hawass Mein

Iss Mukhtasir Si Zindgi Ka Ik Aor Din Beet Gaya...!!!


--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

.::VULMSIT::.eNoxel more Updated Viva & Presentations help century complete :)

Aslam O Alikum

Friends now a day's viva & presentations start

and fellows need help am making a threat in ma site www.vubaba.com and 2470+ fellows visit that threat in few days means fellows can get help from there as per requirement and help purpose more viva & presentation experience share its now century complete 108+ fellows current viva experience its v useful for viva students links are updated daily

Remember Me in Your Prayers

Best regard's
Ch. Muhammad Afaaq (Arrien)

MBA (Finance) 
Islamabad
Afaaq_Tariq@yahoo.com

0346-5329264

For latest assignments solved quizzes files GDB, Solve & Unsolved Past Papers come join us in

http://www.vubaba.com

http://groups.google.com/group/vustudymania

If u like me than raise your hand with me
If not then raise ur standard
That's about me … !

--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

[~>VU-P!nD!<~] more Updated Viva & Presentations help century complete :)

Aslam O Alikum

Friends now a day's viva & presentations start

and fellows need help am making a threat in ma site www.vubaba.com and 2470+ fellows visit that threat in few days means fellows can get help from there as per requirement and help purpose more viva & presentation experience share its now century complete 108+ fellows current viva experience its v useful for viva students links are updated daily

Remember Me in Your Prayers

Best regard's
Ch. Muhammad Afaaq (Arrien)

MBA (Finance) 
Islamabad
Afaaq_Tariq@yahoo.com

0346-5329264

For latest assignments solved quizzes files GDB, Solve & Unsolved Past Papers come join us in

http://www.vubaba.com

http://groups.google.com/group/vustudymania

If u like me than raise your hand with me
If not then raise ur standard
That's about me … !

--
You received this message because you are subscribed to the Google
Groups "vupindi" group.
To post to this group, send email to vupindi@googlegroups.com
To unsubscribe from this group, send email to
vupindi+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vupindi?hl=en

.::VULMSIT::.eNoxel classes

hey can any one plz guide mehow can i find main classes of my project. m doing project of mcs (PRAS)

--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

.::VULMSIT::.eNoxel CS302 – Digital Logic Design Lecture # 1



An Overview & Number Systems
Analogue versus Digital
Most of the quantities in nature that can be measured are continuous. Examples
include
• Intensity of light during the day: The intensity of light gradually increases as the
sun rises in the morning; it remains constant throughout the day and then gradually
decreases as the sun sets until it becomes completely dark. The change in the light
throughout the day is gradual and continuous. Even with a sudden change in weather
when the sun is obscured by a cloud the fall in the light intensity although very sharp
however is still continuous and is not abrupt.
• Rise and fall in temperature during a 24-hour period: The temperature also rises
and falls with the passage of time during the day and in the night. The change in
temperature is never abrupt but gradual and continuous.
• Velocity of a car travelling from A to B: The velocity of a car travelling from one
city to another varies in a continuous manner. Even if it abruptly accelerates or stops
suddenly, the change in velocity seemingly very sudden and abrupt is never abrupt in
reality. This can be confirmed by measuring the velocity in short time intervals of few
milliseconds.
The measurable values generally change over a continuous range having a minimum
and maximum value. The temperature values in a summer month change between 23 0C
to 45 0C. A car can travel at any velocity between 0 to 120 mph.
Digital representing of quantities
Digital quantities unlike Analogue quantities are not continuous but represent
quantities measured at discrete intervals. Consider the continuous signal as shown in the
figure 1.1.
To represent this signal digitally the signal is sampled at fixed and equal intervals.
The continuous signal is sampled at 15 fixed and equal intervals. Figure 1.2. The set of
values (1, 2, 4, 7, 18, 34, 25, 23, 35, 37, 29, 42, 41, 25 and 22) measured at the sampling
points represent the continuous signal. The 15 samples do not exactly represent the
original signal but only approximate the original continuous signal. This can be
confirmed by plotting the 15 sample points. Figure 1.3. The reconstructed signal from the
15 samples has sharp corners and edges in contrast to the original signal that has smooth
curves.
If the number of samples that are collected is reduced by half, the reconstructed signal
will be very different from the original. The reconstructed signal using 7 samples have
missing peak and dip at 34 0C and 23 0C respectively. Figure 1.4. The reason for the
difference between the original and the reconstructed signal is due to under-sampling. A
more accurate representation of the continuous signal is possible if the number of
CS302 – Digital Logic Design
Virtual University of Pakistan Page 2
samples and sampling intervals are increased. If the sampling is increased to infinity the
number of values would still be discrete but they would be very close and closely match
the actual signal.
Figure 1.1 Continuous signal showing temperature varying with time
Figure 1.2 Sampling the Continuous Signal at 15 equal intervals
0
5
10
15
20
25
30
35
40
45
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
time
temperature 0C
1 2
4
7
34
25
23
37
29
42 41
25
22
18
35
0
5
10
15
20
25
30
35
40
45
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
time
temperature 0C
CS302 – Digital Logic Design
Virtual University of Pakistan Page 3
Figure 1.3 Reconstructed Signal by plotting 15 sampled values
Figure 1.4 Reconstructed Signal by plotting 7 sampled values
Electronic Processing of Continuous and Digital Quantities
Electronic Processing of the continuous quantities or their Digital representation
requires that the continuous signals or the discrete values be converted and represented in
terms of voltages. There are basically two types of Electronic Processing Systems.
• Analogue Electronic Systems: These systems accept and process continuous signals
represented in the form continuous voltage or current signals. The continuous
1 2
4
7
18
34
25
23
35
37
29
42 41
25
22
0
5
10
15
20
25
30
35
40
45
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
samples
temperature 0C
0
5
10
15
20
25
30
35
40
45
1 3 5 7 9 11 13 15
samples
temperature 0C
CS302 – Digital Logic Design
Virtual University of Pakistan Page 4
quantities are converted into continuous voltage or current signals by transducers. The
block diagram describes the processing by an Analogue Electronic System. Figure
1.5.
• Digital Electronic Systems: These systems accept and process discrete samples
representing the actual continuous signal. Analogue to Digital Converters are used to
sample the continuous voltage signals representing the original signal.
Do the Digital Electronic Systems use voltages to represent the discrete samples of
the continuous signal? This question can be answered by considering a very simple
example of a calculator which is a Digital Electronic System. Assume that a calculator is
calibrated to represents the number 1 by 1 millivolt (mV). Thus the number 39 is
represented by the calculator in terms of voltage as 39 mV. Calculators can also represent
large numbers such as 6.25 x 1018 (as in 1 Coulomb = 6.25 x 1018 electrons). The value in
terms of volts is 6.25 x 1015 volts! This voltage value can not be practically represented
by any electronic circuit. Thus Digital Systems do not use discrete samples represented as
voltage values.
Figure 1.5 Analogue Electronic System processing continuous quantities
Digital Systems and Digital Values
Digital systems are designed to work with two voltage values. A +5 volts represents a
logic high state or logic 1 state and 0 volts represents a logic low state or logic 0 state.
The Digital Systems which are based on two voltage values or two states can easily
represent any two values. For example,
• The numbers '0' and '1'
• The state of a switch 'on' or 'off'
• The colour 'black' and 'white'
• The temperature 'hot' and 'cold'
• An object 'moving' or 'stationary'
CS302 – Digital Logic Design
Virtual University of Pakistan Page 5
Representing two values or two states is not very practical, as many naturally
occurring phenomenons have values or state that are more than two. For example,
numbers have widely varying ranges, a colour palette might have 64 different shades of
the colour red, the temperature of boiling water at room temperature varies from 30 0C to
100 0C. Digital Systems are based on the Binary Number system which allows more than
two or multiple values to be represented very conveniently.
Binary Number System
The Binary Number System unlike the Decimal number system is based on two
values. Each digit or bit in Binary Number system can represent only two values, a '0'
and a '1'. A single digit of the Decimal Number system represents 10 values, 0, 1, 2 to 9.
The Binary Number System can be used to represent more than two values by combining
binary digits or bits. In a Decimal Number System a single digit can represent 10
different values (0 to 9), representing more than 10 values requires a combination of two
digits which allows up to 100 values to be represented (0 to 99). A Combination of
Binary Numbers is used to represent different quantities.
• Represent Colours: A palette of four colours red, blue, green and yellow can be
represented by a combination of two digital values 00, 01, 10 and 11 respectively.
• Representing Temperature: An analogue value such as 39oC can be represented in a
digital format by a combination of 0s and 1s. Thus 39 is 100111 in digital form.
Any quantity such as the intensity of light, temperature, velocity, colour etc. can be
represented through digital values. The number of digits (0s and 1s) that represents a
quantity is proportional to the range of values that are to be represented. For example, to
represent a palette of eight colours a combination of three digits is used. Representing a
temperature range of 00 C to 1000 C requires a combination of up to seven digits.
Digital Systems uses the Binary Number System to represent two or multiple
values, stores and processes the binary values in terms of 5 volts and 0 volts. Thus the
number 39 represented in binary as 100111 is stored electronically in as +5 v, 0v, 0v, +5
v, +5 v and +5 v.
Advantages of working in the Digital Domain
Handling information digitally offers several advantages. Some of the merits of a
digital system are spelled out. Details of some these aspects will be discussed and studied
in the Digital Logic Design course. Other aspects will be covered in several other
courses.
• Storing and processing data in the digital domain is more efficient: Computers
are very efficient in processing massive amounts of information and data. Computers
process information that is represented digitally in the form of Binary Numbers. A
Digital CD stores large number of video and audio clips. Sam number of audio and
video clips if stored in analogue form will require a number of video and audio
cassettes.
• Transmission of data in the digital form is more efficient and reliable: Modern
information transmission techniques are relying more on digital transmission due to
CS302 – Digital Logic Design
Virtual University of Pakistan Page 6
its reliability as it is less prone to errors. Even if errors occur during the transmission
methods exist which allow for quick detection and correction of errors.
• Detecting and Correcting errors in digital data is easier: Coding Theory is an area
which deals with implementing digital codes that allow for detection and correction
of multi-bit errors. In the Digital Logic Design course a simple method to detect
single bit errors using the Parity bit will be considered.
• Data can be easily and precisely reproduced: The picture quality and the sound
quality of digital videos are far more superior to those of analogue videos. The reason
being that the digital video stored as digital numbers can be exactly reproduced where
as analogue video is stored as a continuous signal can not be reproduced with exact
precision.
• Digital systems are easy to design and implement: Digital Systems are based on
two-state Binary Number System. Consequently the Digital Circuitry is based on the
two-voltage states, performing very simple operations. Complex Microprocessors are
implemented using simple digital circuits. Several simple Digital Systems will be
discussed in the Digital Logic course.
• Digital circuits occupy small space: Digital circuits are based on two logical states.
Electronic circuitry that implements the two states is very simple. Due to the
simplicity of the circuitry it can be easily implemented in a very small area. The PC
motherboard having an area of approximately 1 sq.ft has most of the circuitry of a
powerful computer. A memory chip small enough to be held in the palm of a hand is
able to store an entire collection of books.
Information Processing by a Digital System
A Digital system such as a computer not only handles numbers but all kinds of
information.
• Numbers: A computer is able to store and process all types of numbers, integers,
fractions etc. and is able to perform different kinds of arithmetic operations on the
numbers.
• Text: A computer in a news reporting room is used to write and edit news reports. A
Mathematician uses a computer to write mathematical equations explaining the
dissipation of heat by a heat sink. The computer is able to store and process text and
symbols.
• Drawings, Diagrams and Pictures: A computer can store very conveniently
complex engineering drawings and diagrams. It allows real life still pictures or videos
to be processed and edited.
• Music and Sound: Musicians and Composers uses\ a computer to work on a new
compositions. Computers understand spoken commands.
A Digital System (computer) is capable of handling different types of information,
which is represented in the form of Binary Numbers. The different types of information
use different standards and binary formats. For example, computers use the Binary
number system to represent numbers. Characters used in writing text are represented
through yet another standard known as ASCII which allows alphabets, punctuation marks
and numbers to be represented through a combination of 0s and 1s.
CS302 – Digital Logic Design
Virtual University of Pakistan Page 7
Digital Components and their internal working
Digital system process binary information electronically through specialized circuits
designed for handling digital information. These circuits as mentioned earlier operate
with two voltage values of +5 volts and 0 volts. These specialized electronic circuits are
known as Logic Gates and are considered to be the Basic Building Blocks of any Digital
circuit.
The commonly used Logic Gates are the AND gate, the OR gate and the Inverter or
NOT Gate. Other gates that are frequently used include NOR, NAND, XOR and XNOR.
Each of these gates is designed to perform a unique operation on the input information
which is known as a logical or Boolean operation.
Large and complex digital system such as a computer is built using combinations of
these basic Logic Gates. These basic building blocks are available in the form of
Integrated Circuit or ICs. These gates are implemented using standard CMOS and TTL
technologies that determine the operational characteristics of the gates such as the power
dissipation, operational voltages (3.3v or 5 v), frequency response etc.
Figure 1.6 Symbolic representations of logic gates.
Combinational Logic Circuits and Functional Devices
The logic gates which form the basic building blocks of a digital system are designed
to perform simple logic operations. A single logic gate is not of much use unless it is
connected with other gates to collectively act upon the input data. Different gates are
combined to build a circuit that is capable of performing some useful operation like
adding three numbers. Such circuits are known as Combinational Logic Circuits or
Combinational Circuits. An Adder Combinational Circuit that is able to add two single
bit binary numbers and give a single bit Sum and Carry output is shown. Figure 1.7.
Implementing large digital system by connecting together logic gates is very tedious
and time consuming; the circuit implemented occupies large space, are power hungry,
slow and are difficult to troubleshoot.
CS302 – Digital Logic Design
Virtual University of Pakistan Page 8
Figure 1.7 1-bit Full-Adder Combinational Circuit
Digital circuits to perform specific functions are available as Integrated Circuits for
use. Implementing a Digital system in terms of these dedicated functional units makes
the system more economical and reliable. Thus an adder circuit does not have to be
implemented by connecting various gates, a standard Adder IC is available that can be
readily used. Other commonly used combinational functional devices are Comparators,
Decoders, Encoders, Multiplexers and Demultiplexers.
Sequential logic and implementation
Digital systems are used in vast variety of industrial applications and house hold
electronic gadgets. Many of these digital circuits generate an output that is not only
dependent on the current input but also some previously saved information which is used
by the digital circuit. Consider the example of a digital counter which is used by many
digital applications where a count value or the time of the day has to be displayed. The
digital counter which counts downwards from 10 to 0 is initialized to the value 10. When
the counter receives an external signal in the form of a pulse the counter decrements the
count value to 9. On receiving successive pulses the counter decrements the currently
stored count value by one, until the counter has been decremented to 0. On reaching the
count value zero, the counter could switch off a washing machine, a microwave oven or
switch on an air-conditioning system.
The counter stores or remembers the previous count value. The new count value is
determined by the previously stored count value and the new input which it receives in
the form of a pulse (a binary 1). The diagram of the counter circuit is shown in the figure.
Figure 1.8.
Digital circuits that generate a new output on the basis of some previously stored
information and the new input are known as Sequential circuits. Sequential circuits are a
combination of Combinational circuits and a memory element which is able to store some
previous information. Sequential circuits are a very important part of digital systems.
Most digital systems have sequential logic in addition to the combinational logic. An
A
B
Σ
Cout
Cin
P
G
CS302 – Digital Logic Design
Virtual University of Pakistan Page 9
example of sequential circuits is counters such as the down-counter which generates a
new decremented output value based on the previous stored value and an external input.
The storage element or the memory element which is an essential part of a sequential
circuit is implemented a flip-flop using a very simple digital circuit known as a flip-flop.
Figure 1.8 A Counter Sequential Circuit
Programmable Logic Devices (PLDs)
The modern trend in implementing specialized dedicated digital systems is through
configurable hardware; hardware which can be programmed by the end user. A digital
controller for a washing machine can be implemented by connecting together pieces of
combinational and sequential functional units. These implementations are reliable
however they occupy considerable space. The implementation time also increases. A
general purpose circuit that can be programmed to perform a certain task like controlling
a washing machine reduces the implementation cost and time.
Cost is incurred on implementing a digital controller for a washing machine which
requires that an inventory of all its components such as its logic circuits, functional
devices and the counter circuits be maintained. The implementation time is significantly
high as all the circuit components have to be placed on a circuit board and connected
together. If there is a change in the controller circuit the entire circuit board has to be
redesigned. A PLD based washing machine controller does not require a large inventory
of components to be maintained. Most of the functionality of the controller circuit is
implemented within a single PLD integrated circuit thereby considerably reducing the
circuit size. Changes in the controller design can be readily implemented by
programming the PLD.
Programmable Logic Devices can be used to implement Combinational and
Sequential Digital Circuits.
CS302 – Digital Logic Design
Virtual University of Pakistan Page 10
Memory
Memory plays a very important role in Digital systems. A research article being
edited by a scientist on a computer is stored electronically in the digital memory whilst
changes are being made to the document. Once the document has be finalized and stored
on some media for subsequent printing the memory can be reused to work on some other
document. Memory also needs to store information permanently even when the electrical
power is turned off. Permanent memories usually contain essential information required
for operating the digital system. This important information is provided by the
manufacturer of a digital system.
Memory is organized to allow large amounts of data storage and quick access.
Memory (ROM) which permanently stores data allows data to be read only. The Memory
does not allow writing of data. Volatile memory (RAM) does not store information
permanently. If the power supplied to the RAM circuitry is turned off, the contents of the
RAM are permanently lost and can not be recovered when power is restored. RAM
allows reading and writing of data. Both RAM and ROM are an essential part of a digital
system.
Analogue to Digital and Digital to Analogue conversion and
Interfacing
Real-world quantities as mention earlier are continuous in nature and have widely
varying ranges. Processing of real-world information can be efficiently and reliably done
in the digital domain. This requires real-world quantities to be read and converted into
equivalent digital values which can be processed by a digital system. In most cases the
processed output needs to be converted back into real-world quantities. Thus two
conversions are required, one from the real-world to the digital domain and then back
from the digital domain to the real-world.
Modern digitally controlled industrial units extensively use Analogue to Digital (A/D)
and Digital to Analogue (D/A) converters to covert quantities represented as an analogue
voltage into an equivalent digital representation and vice versa. Consider the example of
an industrial controller that controls a chemical reaction vessel which is being heated to
expedite the chemical reaction. Figure 1.9. Temperature of the vessel is monitored to
control the chemical reaction. As the temperature of the vessel rises the heat has to be
reduced by a proportional level. An electronic temperature sensor (transducer) converts
the temperature into an equivalent voltage value. This voltage value is continuous and
proportion to the temperature. The voltage representing the temperature is converted into
a digital representation which is fed to a digital controller that generates a digital value
corresponding to the desired amount of heat. The digitized output representing the heat is
converted back to a voltage value which is continuous and is used to control a valve that
regulates the heat. An A/D converter converts the analogue voltage value representing the
temperature into a corresponding digital value for processing. A D/A converter converts
back the digital heat value to its corresponding continuous value for regulating the heater.
CS302 – Digital Logic Design
Virtual University of Pakistan Page 11
Figure 1.9 Digitally Controlled Industrial Heater Unit
A/D and D/A converters are an important aspect of digital systems. These devices
serve as a bridge between the real and digital world allow the two to communicate and
interact together.
Number Systems and Codes
Decimal Number System
The decimal number system has ten unique digits 0, 1, 2, 3… 9. Using these single
digits, ten different values can be represented. Values greater than ten can be represented
by using the same digits in different combinations. Thus ten is represented by the number
10, two hundred seventy five is represented by 275 etc. Thus same set of numbers 0,1
2… 9 are repeated in a specific order to represent larger numbers.
The decimal number system is a positional number system as the position of a digit
represents its true magnitude. For example, 2 is less than 7, however 2 in 275 represents
200, whereas 7 represents 70. The left most digit has the highest weight and the right
most digit has the lowest weight. 275 can be written in the form of an expression in terms
of the base value of the number system and weights.
2 x 102 + 7 x 101 + 5 x 100 = 200 + 70 + 5 = 275
where, 10 represents the base or radix
102, 101, 100 represent the weights 100, 10 and 1 of the numbers 2, 7 and 5
Fractions in Decimal Number System
In a Decimal Number System the fraction part is separated from the Integer part by a
decimal point. The Integer part of a number is written on the left hand side of the decimal
point. The Fraction part is written on the right side of the decimal point. The digits of the
Digital
Controller
Transducer
A/D
Converter
D/A
Converter
Vessel
Heater
CS302 – Digital Logic Design
Virtual University of Pakistan Page 12
Integer part on the left hand side of the decimal point have weights 100, 101, 102 etc.
respectively starting from the digit to the immediate left of the decimal point and moving
away from the decimal point towards the most significant digit on the left hand side.
Fractions in decimal number system are also represented in terms of the base value of the
number system and weights. The weights of the fraction part are represented by 10-1, 10-2,
10-3 etc. The weights decrease by a factor of 10 moving right of the decimal point. The
number 382.91 in terms of the base number and weights is represented as
3 x 102 + 8 x 101 + 2 x 100 + 9 x 10-1 + 1 x 10-2 = 300 + 80 + 2 + 0.9 + 0.01 = 382.91
Caveman number system
A number system discovered by archaeologists in a prehistoric cave indicates that
the caveman used a number system that has 5 distinct shapes Σ, Δ, >, Ω and ↑.
Furthermore it has been determined that the symbols Σ to ↑ represents the decimal
equivalents 0 to 5 respectively.
Centuries ago a caveman returning after a successful hunting expedition records
his successful hunt on the cave wall by carving out the numbers Δ↑. What does the
number Δ↑ represent? The table 1.1 indicates that the Caveman numbers Δ↑ represents
decimal number 9.
Decimal Number Caveman Number Decimal Number Caveman Number
0 Σ 10 >Σ
1 Δ 11 >Δ
2 > 12 >>
3 Ω 13 >Ω
4 ↑ 14 >↑
5 ΔΣ 15 ΩΣ
6 ΔΔ 16 ΩΔ
7 Δ> 17 Ω>
8 ΔΩ 18 ΩΩ
9 Δ↑ 19 Ω↑
20 ↑Σ
Table 1.1 Decimal equivalents of the Caveman Numbers
The Caveman is using a Base-5 number system. A Base-5 number system has five
unique symbols representing numbers 0 to 4. To represent numbers larger than 4, a
combination of 2, 3, 4 or more combinations of Caveman numbers are used. Therefore, to
represent the decimal number 5, a two number combination of the Caveman number
system is used. The most significant digit is Δ which is equivalent to decimal 1. The least
significant digit is Σ which is equivalent to decimal 0. The five combinations of
Caveman numbers having the most significant digit Δ, represent decimal values 5 to 9
respectively. This is similar to the Decimal Number system, where a 2-digit combination
CS302 – Digital Logic Design
Virtual University of Pakistan Page 13
of numbers is used to represent values greater than 9. The most significant digit is set to 1
and the least significant digit varies from 0 to 9 to represent the next 10 values after the
largest single decimal number digit 9.
The Caveman number Δ↑ can be written in expression form based on the Base
value 5 and weights 50, 51, 52 etc.
= Δ x 51 + ↑ x 50 = Δ x 5 + ↑ x 1
Replacing the Caveman numbers Δ and ↑ with equivalent decimal values in the
expression yields
= Δ x 51 + ↑ x 50 = 1 x 5 + 4 x 1 = 9
The number ΔΩ↑Σ in decimal is represented in expression form as
Δ x 53 + Ω x 52 + ↑ x 51 + Σ x 50 = Δ x 125 + Ω x 25 + ↑ x 5 + Σ x 1
Replacing the Caveman numbers with equivalent decimal values in the expression yields
= (1) x 125 + (3) x 25 + (4) x 5 + (0) x 1 = 125 + 75 + 20 + 0 = 220
Binary Number System
The Caveman Number system is a hypothetical number system introduced to
explain that number system other than the Decimal Number system can exist and can be
used to represent and count numbers. Digital systems use a Binary number system.
Binary as the name indicates is a Base-2 number system having only two numbers 0 and
1. The Binary digit 0 or 1 is known as a 'Bit'. Table 1.2
Decimal Number Binary Number Decimal Number Binary Number
0 0 10 1010
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011
20 10100
Table 1.2 Decimal equivalents of Binary Number System
CS302 – Digital Logic Design
Virtual University of Pakistan Page 14
Counting in Binary Number system is similar to counting in Decimal or Caveman
Number systems. In a decimal Number system a value larger than 9 has to be represented
by 2, 3, 4 or more digits. In the Caveman Number System a value larger than 4 has to be
represented by 2, 3, 4 or more digits of the Caveman Number System. Similarly, in the
Binary Number System a Binary number larger than 1 has to be represented by 2, 3, 4 or
more binary digits.
Any binary number comprising of Binary 0 and 1 can be easily represented in
terms of its decimal equivalent by writing the Binary Number in the form of an
expression using the Base value 2 and weights 20, 21, 22 etc.
The number 100112 (the subscript 2 indicates that the number is a binary number
and not a decimal number ten thousand and eleven) can be rewritten in terms of the
expression
100112 = (1 x 24) + (0 x 23) + (0 x 22) + (1 x 21) + (1 x 20)
= (1 x 16) + (0 x 8) + (0 x 4) + (1 x 2) + (1 x 1)
= 16 + 0 + 0 + 2 + 1
= 19
Fractions in Binary Number System
In a Decimal number system the Integer part and the Fraction part of a number are
separated by a decimal point. In a Binary Number System the Integer part and the
Fraction part of a Binary Number can be similarly represented separated by a decimal
point. The Binary number 1011.1012 has an Integer part represented by 1011 and a
fraction part 101 separated by a decimal point. The subscript 2 indicates that the number
is a binary number and not a decimal number. The Binary number 1011.1012 can be
written in terms of an expression using the Base value 2 and weights 23, 22, 21, 20, 2-1, 2-2
and 2-3.
1011.1012 = (1 x 23) + (0 x 22) + (1 x 21) + (1 x 20) + (1 x 2-1) + (0 x 2-2) + (1 x 2-3)
= (1 x 8) + (0 x 4) + (1 x 2) + (1 x 1) + (1 x 1/2) + (0 x 1/4) + (1 x 1/8)
= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125
= 11.625
Computers do handle numbers such as 11.625 that have an integer part and a
fraction part. However, it does not use the binary representation 1011.101. Such numbers
are represented and used in Floating-Point Numbers notation which will be discussed
latter.

--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en

.::VULMSIT::.eNoxel Data Structures - CS301 Lecture # 2 Please Discuss here

Data Structures

Lecture No. 02

 

Reading Material

 

Data Structures and Algorithm Analysis in C++                                Chapter. 3

                                                                                                                                                            3.1, 3.2,             3.2.1, 3.2.2

Summary

 

1)         List Implementation   

·   add Method

·   next Method

·   remove Method

·   find Method

·   Other Methods  

2)         Analysis Of Array List

3)         List Using Linked Memory

4)         Linked List

           

Today, we will discuss the concept of list operations. You may have a fair idea of ' start operation' that sets the current pointer to the first element of the list while the tail operation moves the current pointer to the last element of the list. In the previous lecture, we discussed the operation next that moves the current pointer one element forward. Similarly, there is the 'back operation' which moves the current pointer one element backward.

 

List Implementation

Now we will see what the implementation of the list is and how one can create a list in C++. After designing the interface for the list, it is advisable to know how to implement that interface. Suppose we want to create a list of integers. For this purpose, the methods of the list can be implemented with the use of an array inside. For example, the list of integers (2, 6, 8, 7, 1) can be represented in the following manner where the current position is 3.

 

A   

2

6

8

7

1

 

 

 

  current

size

 

1

2

3

4

5

 

 

 

       3

   5

 

In this case, we start the index of the array from 1 just for simplification against the usual practice in which the index of an array starts from zero in C++. It is not necessary to always start the indexing from zero. Sometimes, it is required to start the indexing from 1. For this, we leave the zeroth position and start using the array from index 1 that is actually the second position. Suppose we have to store the numbers from 1 to 6 in the array. We take an array of 7 elements and put the numbers from the index 1. Thus there is a correspondence between index and the numbers stored in it. This is not very useful. So, it does not justify the non-use of zeroth position of the array out-rightly. However for simplification purposes, it is good to use the index from 1.

 

add Method

Now we will talk about adding an element to the list. Suppose there is a call to add an element in the list i.e. add(9). As we said earlier that the current position is 3, so by adding the element 9 to the list, the new list will be (2, 6, 8, 9, 7, 1).

To add the new element (9) to the list at the current position, at first, we have to make space for this element. For this purpose, we shift every element on the right of 8 (the current position) to one place on the right. Thus after creating the space for new element at position 4, the array can be represented as

 

A   

2

6

8

 

7

1

 

 

  current

size

 

1

2

3

4

5

 

 

 

       3

   5

Now in the second step, we put the element 9 at the empty space i.e. position 4. Thus the array will attain the following shape. The figure shows the elements in the array in the same order as stored in the list.

 

A   

2

6

8

9

7

1

 

 

   current

size

 

1

2

3

4

5

6

 

 

        4

   6

We have moved the current position to 4 while increasing the size to 6. The size shows that the elements in the list. Where as the size of the array is different that we have defined already to a fixed length, which may be 100, 200 or even greater.

 

next Method

Now let's see another method, called 'next'. We have talked that the next method moves the current position one position forward. In this method, we do not add a new element to the list but simply move the pointer one element ahead. This method is required while employing the list in our program and manipulating it according to the requirement.  There is also an array to store the list in it. We also have two variables- current and size to store the position of current pointer and the number of elements in the list. By looking on the values of these variables, we can find the state of the list i.e. how many elements are in the list and at what position the current pointer is.

The method next is used to know about the boundary conditions of the list i.e. the array being used by us to implement the list. To understand the boundary conditions, we can take the example of an array of size 100 to implement the list. Here, 100 elements are added to the array. Let's see what happens when we want to add 101st element to the array? We used to move the current position by next method and reached the 100th position. Now, in case of moving the pointer to the next position (i.e. 101st), there will be an error as the size of the array is 100, having no position after this point. Similarly if we move the pointer backward and reach at the first position regardless that the index is 0 or 1. But what will happen if we want to move backward from the first position? These situations are known as boundary conditions and need attention during the process of writing programs when we write the code to use the list. We will take care of these things while implementing the list in C++ programs.

 

remove Method

We have seen that the add method adds an element in the list. Now we are going to discuss the remove method. The remove method removes the element residing at the current position. The removal of the element will be carried out as follows. Suppose there are 6 elements (2, 6, 8, 9, 7, 1) in the list. The current pointer is pointing to the position 5 that has the value 7. We remove the element, making the current position empty. The size of the list will become 5. This is represented in the following figure.

 

 


A   

2

6

8

9

 

1

 

 

  current

size

1

2

3

4

5

6

 

 

       5

  6

      5

 

We fill in the blank position left by the removal of 7 by shifting the values on the right of position 5 to the left by one space. This means that we shift the remaining elements on the right hand side of the current position one place to the left so that the element next to the removed element (i.e. 1) takes its place (the fifth position) and becomes the current position element. We do not change the current pointer that is still pointing to the position 5. Thus the current pointer remains pointing to the position 5 despite the fact that there is now element 1 at this place instead of 7. Thus in the remove method, when we remove an element, the element next to it on the right hand side comes at its place and the remaining are also shifted one place to the right. This step is represented by the following figure.

 

 


A   

2

6

8

9

1

 

 

 

  current

size

 

1

2

3

4

5

 

 

 

       5

   5

 

find Method

Now lets talk about a function, used to find a specific element in the array. The find (x) function is used to find a specific element in the array. We pass the element, which is to be found, as an argument to the find function. This function then traverses the array until the specific element is found. If the element is found, this function sets the current position to it and returns 1 i.e. true. On the other hand, if the element is not found, the function returns 0 i.e. false. This indicates that the element was not found. Following is the code of this find(x) function in C++.

 

int find (int x)

{

            int j ;

            for (j = 1; j < size + 1; j++ )

                            if (A[j] == x )

                                     break ;

            if ( j < size + 1)                                    // x is found

            {

                              current = j ;                                    //current points to the position where x found

                              return 1 ;                                        // return true

            }

            return 0 ;                                                          //return false, x is not found

}

 

In the above code, we execute a for loop to traverse the array. The number of execution of this loop is equal to the size of the list. This for loop gets terminated when the value of loop variable (j) increases from the size of the list. However we terminate the loop with the break statement if the element is found at a position. When the control comes out from the loop, we check the value of j. If the value of j is less than the size of the array, it means that the loop was terminated by the break statement. We use the break statement when we find the required element (x) in the list. The execution of break statement shows that the required element was found at the position equal to the value of j. So the program sets the current position to j and comes out the function by returning 1 (i.e. true). If the value of j is greater than the size of the array, it means that the whole array has traversed and the required element is not found. So we simply return 0 (i.e. false) and come out of the function.

 

Other Methods

There are some other methods to implement the list using an array. These methods are very simple, which perform their task just in one step (i.e. in one statement). There is a get() method , used to get the element from the current position in the array. The syntax of this function is of one line and is as under

 

                                                return A[current] ;

 

This statement returns the element to which the current is pointing to (i.e. the current position) in the list A.

Another function is update(x). This method is used to change (set) the value at the current position. A value is passed to this method as an argument. It puts that value at the current position. The following statement in this method carries out this process.

 

                                                A [current] = x ;

 

Then there is a method length( ).This method returns the size of the list. The syntax of this method is    

                                                return size ;     

 

You may notice here that we are returning the size of the list and not the size of the array being used internally to implement the list. This size is the number of the elements of the list, stored in the array.

 

The back() method decreases the value of variable current by 1. In other words, it moves the current position one element backward. This is done by writing the statement.

                                               

                                                current -- ;

 

The -- is a decrement operator in C++ that decreases the value of the operand by one. The above statement can also be written as

                                               

                                                current = current -1 ;

 

The start() method sets the current position to the first element of the list. We know that the index of the array starts from 0 but we use the index 1 for the starting position. We do not use the index zero. So we set the current position to the first element by writing

                                                           

                                                current = 1 ;

 

Similarly, the end() method sets the current position to the last element of the list i.e. size. So we write

                                                current = size ;

 

Analysis of Array List

Now we analyze the implementation of the list while using an array internally. We analyze different methods used for the implementation of the list. We try to see the level upto which these are efficient in terms of CPU's time consumption. Time is the major factor to see the efficiency of a program.

 

Add

First of all, we have talked about the add method. When we add an element to the list, every element is moved to the right of the current position to make space for the new element. So, if the current position is the start of the list and we want to add an element in the beginning, we have to shift all the elements of the list to the right one place. This is the worst case of adding an element to the list. Suppose if the size of the list is 10000 or 20000, we have to do the shift operation for all of these 10000 or 20000 elements. Normally, it is done by shifting of elements with the use of a for loop. This operation takes much time of the CPU and thus it is not a good practice to add an element at the beginning of a list. On the other hand, if we add an element at the end of the list, it can be done by carrying out 'no shift operation'. It is the best case of adding an element to the list. However, normally we may have to move half of the elements. The usage of add method is the matter warranting special care at the time of implementation of the list in our program. To provide the interface of the list, we just define these methods.

 

Remove

When we remove an element at the current position in the list, its space gets empty. The current pointer remains at the same position. To fill this space, we shift the elements on the right of this empty space one place to the left. If we remove an element from the beginning of the list, then we have to shift the entire remaining elements one place to the left. Suppose there is a large number of elements, say 10000 or 20000, in the list. We remove the first element from the list. Now to fill this space, the remaining elements are shifted (that is a large number). Shifting such a large number of elements is time consuming process. The CPU takes time to execute the for loop that performs this shift operation. Thus to remove an element at the beginning of the list is the worst case of remove method. However it is very easy to remove an element at the end of the list. In average cases of the remove method we expect to shift half of the elements. This average does not mean that in most of the cases, you will have to shift half the elements. It is just the average. We may have to shift all the elements in one operation (if we remove at the beginning) and in the second operation, we have to shift no element (if we remove at the end). Similarly, in certain operations, we have to shift just 10, 15 elements.

 

Find

We have discussed that the find method takes an element and traverses the list to find that element. The worst case of the find method is that it has to search the entire list from beginning to end. So, it finds the element at the end of the array or the element is not found. On average the find method searches at most half the list.

 

The other methods get (), length () etc are one-step methods. They carry out their operation in one instruction. There is no need of any loop or other programming structures to perform the task. The get() method gets the value from the specified position just in one step. Similarly the update() method sets a value at the specific position just in one-step. The length () method returns the value of the size of the list. The other methods back(), start() and end() also perform their tasks only in one step.

 

List using Linked Memory

We have seen the implementation of the list with the use of an array. Now we will discuss the implementation of the list while using linked memory. In an array, the memory cells of the array are linked with each other. It means that the memory of the array is contiguous. In an array, it is impossible that one element of the array is located at a memory location while the other element is located somewhere far from it in the memory. It is located in very next location in the memory. It is a property of the array that its elements are placed together with one another in the memory. Moreover, when we have declared the size of the array, it is not possible to increase or decrease it during the execution of the program. If we need more elements to store in the array, there is need of changing its size in the declaration. We have to compile the program again before executing it. Now array will be of the new size. But what happens if we again need to store more elements? We will change the code of our program to change the declaration of the array while recompiling it.

Suppose we have used the dynamic memory allocation and created an array of 100 elements with the use of new operator. In case of need of 200 elements, we will release this array and allocate a new array of 200 elements.  Before releasing the previous array, it will wise to copy its elements to the new array so that it does not lose any information. Now this new array is in 'ready for use' position. Thus the procedure of creating a new array is not an easy task.

To avoid such problems, usually faced by the programmers while using an array, there is need of using linked memory in which the various cells of memory, are not located continuously. In this process, each cell of the memory not only contains the value of the element but also the information where the next element of the list is residing in the memory. It is not necessary that the next element is at the next location in the memory. It may be anywhere in the memory. We have to keep a track of it. Thus, in this way, the first element must explicitly have the information about the location of the second element. Similarly, the second element must know where the third element is located and the third should know the position of the fourth element and so on. Thus, each cell (space) of the list will provide the value of the element along with the information about where the next element is in the memory. This information of the next element is accomplished by holding the memory address of the next element. The memory address can be understood as the index of the array. As in case of an array, we can access an element in the array by its index. Similarly, we can access a memory location by using its address, normally called memory address.

 

Linked List

For the utilization of the concept of linked memory, we usually define a structure, called linked list. To form a linked list, at first, we define a node. A node comprises two fields. i.e. the object field that holds the actual list element and the next that holds the starting location of the next node.

 

 

 

object

 

 

next

 

A chain of these nodes forms a linked list. Now let's consider our previous list, used with an array i.e. 2, 6, 8, 7, 1. Following is the figure which represents the list stored as a linked list.

 

Head

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2

 

 

6

 

 

8

 

 

7

 

 

1

 

   size = 5

 

 

current

 

This diagram just represents the linked list. In the memory, different nodes may occur at different locations but the next part of each node contains the address of the next node. Thus it forms a chain of nodes which we call a linked list.

While using an array we knew that the array started from index 1that means the first element of the list is at index 1. Similarly in the linked list we need to know the starting point of the list. For this purpose, we have a pointer head that points to the first node of the list. If we don't use head, it will not be possible to know the starting position of the list. We also have a pointer current to point to the current node of the list. We need this pointer to add or remove current node from the list. Here in the linked list, the current is a pointer and not an index as we used while using an array. The next field of the last node points to nothing .It is the end of the list. We place the memory address NULL in the last node. NULL is an invalid address and is inaccessible.

Now again consider the list 2, 6, 8, 7, 1. The previous figure represents this list as a linked list. In this linked list, the head points to 2, 2 points to 6, 6 points to 8, 8 points to 7 and 7 points to 1. Moreover we have the current position at element 8.

 

This linked list is stored in the memory. The following diagram depicts the process through which this linked list is stored in the memory.


 

1051

6

 

1052

1063

     current

1053

 

 

1054

2

 

1055

1051

 

1056

 

 

1057

7

 

1058

1060

 

1059

 

 

1060

1

 

1061

0

            head

1062

1054

 

1063

8

 

1064

1057

 

1065

 

 

We can see in the figure that each memory location has an address. Normally in programming, we access the memory locations by some variable names. These variable names are alias for these locations and are like labels that are put to these memory locations. We use head and current variable names instead of using the memory address in numbers for starting and the current nodes. In the figure, we see that head is the name of the memory location 1062 and the name current is used for the memory address 1053. The head holds the address 1054 and the element 2, the first one in the list, is stored in the location 1054. Similarly current holds the address 1063 where the element 8 is stored which is our current position in the list. In the diagram, two memory locations comprise a node. So we see that the location 1054 holds the element 2 while the next location 1055 holds the address of the memory location (1051) where the next element of the list (i.e. 6) is stored. Similarly the next part of the node that has value 6 holds the memory address of the location occupied by the next element (i.e. 8) of the list. The other nodes are structured in a similar fashion. Thus, by knowing the address of the next element we can traverse the whole list.

--
Virtual University of Pakistan*** IT n CS Blog
================================
http://www.enoxel.tk
 
http://itncs.tk
 
 
You received this message because you are subscribed to the Google
Groups "vulms" group.
To post to this group, send email to vulmsit@googlegroups.com
To unsubscribe from this group, send email to
vulmsit+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vulmsit?hl=en?hl=en