| About Us | Contact Us | Privacy Policy | Join Us+ |

WorldTrueSight

Get the latest news and reviews about technology!

Showing posts with label Logic. Show all posts
Showing posts with label Logic. Show all posts

3 Feb 2019

File Organization In Database[COMPLETE CONCEPT]

Database SQL Server

FILE ORGANIZATION:

           Storage and access method of a file is called file organization.

TYPES OF FILE ORGANIZATION:

1.Sequential File Organization
2.Direct access File Organization

SEQUENTIAL FILE ORGANIZATION:

When we have to access data in sequence.
Example:
Tape-drive. In tape drive if we want to access the 2nd video we have to go through the 1st then we can access the second one . We can’t jump directly to  2nd .
ADVANTAGE OF SEQUENTIAL FILE ORGANIZATION:
Sequential saves memory. Because there is no meta data (header/footer) with a single record.

USES OF SEQUENTIAL FILE ORGANIZATION:
Sequential file organization is helpful when we have to access the whole batch . i.e Electricity bills.

DRAWBACKS OF SEQUENTIAL FILE ORGANIZATION:
1.Time loss
2.Searching is difficult in Sequential file Organization
3.If we try to insert a new data we have to reorganize the whole data.
4.If we are searching a data which is not present in the records. It will search the whole data then tell that the data is not present.

DIRECT FILE ORGANIZATION:

Example:


Hard Drive.

ADVANTAGES OF DIRECT FILE ORGANIZATION:

1.Time saving
2.Searching is easy in Direct file Organization

TYPES OF DIRECT FILE ORGANIZATION:

1.Indexed Sequential
2.Hashing


INDEXED SEQUENTIAL:
           
Indexed Sequential is same as Table of Content in books.
HASHING:
   Hashing is a function but not a specific function. We can made our hashing function.

TYPES OF HASHING FUNCTION:

1.Division method
2.Folding method

DIVISION FUNCTION:

x mod y return remainder. If remainder of two numbers are same then it is called hashing conflict.

SOLUTION OF HASHING CONFLICT:

Add 1 to the remainder.

FOLDING METHOD:

You can fold a number to find that in which track the given record should go.

FOR EXAMPLE:

Suppose a record with Student ID 8530 & you have to use folding method to tell that  which hard drive’s track will hold this record ?

  8      5        3       0

            8       5
      +    3      0
      --------------
           11     5   <------- This record will save in 5th 
     ---------------
track in hard drive!

THANK YOU... 🙂

22 Dec 2018

Assembly Language


DESCRIPTION: 

To Print a star Pattern in assembly we use Nested Loop such that ecx register controls the outer or parent loop and ebx register controls the nested or inner loop.

The provided code will ask for a user input. Such that it will ask the user to enter a number and the program will  print a star pattern according to user's entered number.

Complete Documentation => SOURCE CODE



******************************************************
If you find any query regarding the provided code then you are free to ask in the comment section.
THANK YOU ☺️

21 Dec 2018

IMPLEMENTATION OF VENN DIAGRAM :

The Venn Diagram: When Jon Venn first envisioned his new diagram’s future, he surely couldn’t have expected it to be popular more than a century after he created it. However, it has stood the test of time and has remained a popular diagram for showing correlations between different aspect of a subject or even different subjects entirely. Even in today’s modern world of 3D imaging and greatly advanced technology, the Venn Diagram has a firmly cemented place in many people’s daily life.

     The provided Code works on classes. And apply Polish notation Algorithms. (ie infix to postfix conversion + evaluation)

WORKING :

C# Visual Studio

This code will first convert the given Infix Expression to Postfix using STACK and then evaluate it to give the Shaded Region.

Kindly watch this VIDEO 👇 for better understanding , Hope this video helps you

This video credits belongs to respected owner
we don't own this video!
If you're the owner of this video and wan't us to remove just comment below thank you.



COMPLETE DOCUMENTATION => SOURCE CODE

You can also make the Diagram of your own choise. The only change you have to make is in the arrays behind the Calculate button.
C# Visual Studio
 ***************************************************
If you find any Query regarding the provided Code then you can ask in the comment section
Thank You 🙂


TIC TAC TOE in ASSEMBLY 8086 Processor

TIC TAC TOE :


Tic-Tac-Toe is a two-player game with two symbols denoting the two players: X and O. The playing board is a 3x3 square.
The rules are as follows:
  •  Each player takes a turn placing his character (X or O) into one of the nine squares.
  •  A player cannot place his symbol in a square that is already occupied by a symbol.
  •  The game ends when a player creates a winning combination of his symbols or when there are no empty squares remaining.
  •  Winning combination is defined as three horizontally adjacent, three vertically adjacent, or three diagonally adjacent symbols
  •   If neither player creates a winning combination when all nine squares are occupied, the game is a draw, often referred to as a "cat game."

IMPLEMENTATION :

Implementation of TIC TAC TOE in Assembly is a little bit harder than other Programming Languages.The provided code will work in Three Levels :
  • Easy  ( 3x3)
    TIC TAC TOE in ASSEMBLY 8086 Processor


  • Medium (4x4)
    TIC TAC TOE in ASSEMBLY 8086 Processor


  • Hard (5x5)
    TIC TAC TOE in ASSEMBLY 8086 Processor
Such that the number of Rows and Columns increases with the increase of Level.


COMPLETE DOCUMENTATION = > SOURCE CODE
*****************************************************
If you find any query regarding this code.then you are free to ask in the comment section

4 Sep 2018

Irvine Library + Visual Studio

ASSEMBLY LANGUAGE


Added on: 4 / 9 / 2018
Description:

To connect IRVINE with VISUAL STUDIO and get rid of the errors of LINK and others, I prefer you all to download Visual Studio 2010 32/64 bit + Irvine 2010 32 bit !

I've tried it all they possible way and figure it out that the best IDE to work on ASSEMBLY of visual studio is 2010 version! because upgraded version have some issues !
---------------------------------------------------------------------------------
THE DOWNLOAD SECTION
Below are the links provided for Visual Studio and Irvine.
Make sure you download them from here to get no errors !

VISUAL STUDIO 2010 DOWNLOAD LINK:  CLICK ME !
IRVINE LIBRARY WITH EXAMPLES LINK: CLICK ME !
---------------------------------------------------------------------------------
HOW TO CONNECT IT AND WORK

STEP BY STEP PROCEDURE:
1) Install the Irvine Library in C:\
2) Install the Visual Studio !
3) Open Visual Studio and Select a simple C or C++ File and enter your desire name.
4) Then select a C++ console application and name it with .asm execution !
5) Connect the Irvine libraries path as shown below in Video !
7) Enter the code, the structure code is given below.
8) Try printing your name by debugging it.
-----------------------------------------------------------

PATHS [POINT 5]


-----------------------------------------------------------

Structure Code


CODE :
INCLUDE Irvine32.inc
.data
mymessage BYTE"TRUESIGHT",0dh,0ah,0
.code
main proc
mov edx,OFFSET mymessage
call WriteString
exit
main endp
end main

-------------------------------------------------------

For any queries comment below ! 

17 Aug 2018

STATE EQUATIONS , STATE TABLES & STATE DIAGRAM:

Step 1 :

How to make State Equations ? 

Consider the Sequential circuit given below ,
State Equation State Table State Diagram
 Make State Equation of Next State of Flip Flop with the help of basic gates as ,
                                         A(t+1) = A(t)x(t) + B (t) x (t)

Description :

As A is the output of first D Flip Flop , we make Next State equation of A(t+1) . t+1 represent the Next State . As A is connected with 2 AND Gates and an OR Gate . The inputs of first AND Gate are present state of A and x . The inputs of second AND Gate are present state of B and x . Therefore, these inputs are written in equation as A(t)x(t) and B(t)x(t)  . Then both outputs of AND Gates are connected with an OR Gate. Then , the final equation of first D flip flop is ,
                                     A (t+1) = A (t) x (t)  + B (t) x (t)
You can also write as ,
                                   A (t+1) = A . x  + B . x

{Multiplication due to AND GATE and addition symbol because of OR Gate }

Now do the same for B . Make State Equation of Next State of Flip Flop B as ,
                                    B(t+1) = A'(t)  x(t) 

Description :

Because the second D Flip Flop is connected with a single AND Gate . The  inputs of AND Gate are invert of A (A') and x . So the Next State Equation of second D flip flop is ,
                                    B ( t+1) = A'(t) x (t) 
You can also write as ,
                                    B(t+1) = A' . x
{ Multiplication because of AND Gate }

Output Equation :

If the Sequential circuit have Output (As this circuit has y output). Then you have to make output equations using the same method . y is connected with an OR Gate (B and A) or  B(t)+A(t) . Then connected with a NOT Gate x' . Then both outputs of OR Gate and AND Gate are connected with an AND Gate. So, the final output equation will become ,
                              y ( t+ 1) = [ A(t) + B(t) ] x'(t)

You can also write as ,
                             y( t+1 ) = (A + B) x'

What will you do if there is JK - Flip Flop instead of D - Flip Flop? Is there any change ?

The only change is you  will now put the next state of A and B in the general equation of JK- Flip Flop 
i-e :            JQ' + K'Q

For example :

Consider the sequential circuit given below ,
State Equation State Table State Diagram

Now, make State Equation of A using the above method.
The State Equation of A is J =B(t) and K = x' B(t)
Now put these values in  J A' + K'A { HERE OUTPUT IS A therefore Q = A }
                          A(t+1) = A' B(t) + (x'B(t))' A
                           A(t+1) =A'B (t) + (xB'(t))A
                            A(t+1)=A'B(t) + Ax+AB'(t)
or you can also write as,
                            A(t) = A' B  + Ax +AB'
Now, make State Equation of B using the above method.
 The State Equation of A is J=x'  and K= A' x' + A x 
Now put these values in  J B' + K'B { HERE OUTPUT IS B therefore Q = B }
                           B(t+1) = x' B' + (A' x' + A x)' B
                          B(t+1) = x' B' + A' B x + A B x'

Notice that this circuit has no output therefore no output equation . 

What will you do if there is T- Flip Flop instead of JK-Flip Flop? Is there any change ?

No , You will just put the Next State of A and B in the general equation of T-Flip Flop 
i-e      T Q' + T'Q

Step 2 :

How to make State Tables ?

 State Tables (sometimes called transition Table) can be made by two methods ,
Now consider the circuit with D-Flip Flop ,
State Equation State Table State Diagram

First Form of State Table :

First form of State Table includes Present State , Input , Next State and Output (if present in the circuit) . Now! There are three inputs A , B and x.Therefore there are 8 possible combinations. The Next State of   State table will fill by State Equation. For example for the Next State of A x must be equals to 1.So, where x=0 you can simply put the Next State of A = 0 in the State Table. The next condition for Next State of A is either A or B is equals to 1 then the Next State of is 1 . Otherwise Next State of A is 0. So you can see in the Table given below where x is 0 Next State of A is 0 . And when A and B both are 0 , Next State of A is again 0. Except these cases , the next state  of A is 1 .

Next State of B and Output in the State Table can be filled by the same method.  
State Equation State Table State Diagram


Second Form of State Table :

The second form of State Table has no input column but it will divide the inputs in x=0 and x=1 in the Next State & Output as given below. The second form of State Table has less number of rows than First Form of State Table and it is easier to fill. Second form of State Table has greater number of Columns if there are more than one inputs. 
In the Table given below there is only two inputs A and B. Therefore only 4 possible combinations .
Then fill the Next State and Output by the method described above. 

State Equation State Table State Diagram

Step 3 :

How to make State Diagram ?

State Diagram can be made by using two models ,

  • Mealy Model
  • Moore Model                             

 Mealy Model :

State Equation State Table State Diagram

Description :

State Diagram is made with the help of State Table. The Binary number inside the circle represent the Present State of Flip-Flop . The arrows represent the Next State of Flip-Flops. The binary number before the slash represent the input and the binary number after the slash represent the output state at the time of conversion of Flip-Flop from Present State to the Next State. 
(Mealy Model is suitable for this State Table)

Is there any change in the State Table and State Diagram of JK and T - Flip Flop ?

No , the State Table and State Diagram of JK and T- Flip Flop can be created by using the above method.

**************************************************************************************

15 Aug 2018

DIFFERENCE BETWEEN COMBINATIONAL & 

SEQUENTIAL LOGIC CIRCUITS :


COMBINATIONAL CIRCUITS :

  • In combinational circuits , output depends only & immediately on their inputs . They have no memory i-e independent of past values of their inputs. 

DIFFERENCE BETWEEN COMBINATIONAL &  SEQUENTIAL LOGIC CIRCUITS :
  • Combinational circuits are faster & easy to design .
  • Mostly used for Arithmetic & Boolean operation.
  • Logic Gates are the building block of Combinational Circuits.
  • Independent of Clock Pulses & does not require triggering to operate.
  •  The present value of it's outputs are determined by the present value of it's inputs. 
  • Combinational Circuits has no memory units.
  • Parallel Adder is a Combinational Circuit.

  • Examples of Combinational Circuits :
  1. Half & Full Adder 
  2. Half  & Full Subtractor
  3. MUX & DEMUX


SEQUENTIAL CIRCUITS :


  • Sequential circuits, act as storage elements and have memory. They can store, retain, and then retrieve information when needed . Our treatment will distinguish sequential logic from combinational logic. 
    DIFFERENCE BETWEEN COMBINATIONAL &  SEQUENTIAL LOGIC CIRCUITS :
  • Sequential circuits are slower & difficult to design. 
  • Sequential Circuits has memory units to store past outputs.
  • Sequential circuits are used for storing data (hence used in RAM) 
  • Latches or Flip Flop (Binary Storage Devices) are the building block of Sequential Circuits.
  • Dependent of Clock Pulses & requires triggering to operate.
  •  The present value of it's outputs are determined by the present value of it's inputs & it's past state .
  • Serial Adder is a Sequential Circuit.

  • Examples of Sequential Circuits :

  1.  Flip Flop
  2. Shift Registers 
  3. Binary Counters

17 Feb 2018

What is Logic Gate  (AND , OR , NOR, XOR, NAND, XNOR, NOT)?

Do you want to know about Logic Gate ? Lets start with the definition & meaning of Gates.

DEFINITION OF GATES :

Gates are the building blocks used in IC (Integrated Circuit). A logic gate is elementary buliding block of a digital circuit. 
Gates are the device that computes Boolean operation. Gates provide building blocks from which computers are constructed.

BASIC GATES :

There are seven basic Logic Gates :

1. AND :

In AND gate , the output is true if all the inputs are true.

AND input output
AND Input Ouput

2. NAND :

NAND is opposite of AND . The output is true if any input is false.

NAND input output
                           NAND input output

3. OR :

The output is true if either or both inputs are true.

OR INPUT OUTPUT


4. XOR :

 The output is true if either input is true but not if both inputs are true.

XOR INPUT OUTPUT

XOR INPUT OUTPUT

5. NOR :

The opposite of OR is NOR. The output is true only when all inputs are false.

NOR input output

NOR input OUTPUT

6. XNOR :

The outputs are true if the inputs are same and false if the inputs are different.

XNOR Input Output

7. NOT :

NOT has only one input , If the input is true then the output is false and if the input is false then the output is true.

NOT Input Output


****--------------------********-------------********-------------*******
if you find any difficulty regards GATES or LOGIC GATES then you are free to ask in the comment section..
  

11 Feb 2018

HOW TO DO BINARY CONVERSIONS

To start binary conversions you should know that ,
The table of Decimal Starts from 0 and ends with 9
And Hexa starts with 0 & also ends with 9  but also includes A , B , C , D, E , F .. A for 10 , B for 11, C for 12 , D for 13 , E for 14 and F for 15.. The table of OCTAL starts from 0 and ends with 7 . BINARY has only two numbers or digits 1 & 0.

How to do binary conversions
How to convert from Binary to

1. BINARY TO DECIMAL :

  ( 1  0    1   1 )

How to do binary conversions
The number given is a binary number and you have to convert it in DECIMAL . First , you have to know that , To convert a number from binary to decimal you have to apply a formula  2n . 2 is the exponent and n is the power. We will put the number (0,1,2,3,4,...) in place of n and convert it from binary to decimal.
For example :
n=0 (2 power 0 is 1)
n=1 (2 power 1 is 2)
n=2 (2 power 2 is 4 )
n= 3 (2 power 3 is 8)

Now !!
Place these derived numbers with the given decimal number (1   0  1   1)
                       1      0      1      1
                       8      4      2      1
Now the rule says that if the number is ON (having 1 in binary) should be added and if the number having 0 must be cancelled..    
                       1       1        1
                       8  +   2  +    1  =  11 
In this case , we cancelled the number 4 because its binary number is OFF (having a zero) & add 8 , 2 and 1 because their Binary number is ON (having 1)
Our answer is 11 .. Which is a decimal of (1   0   1    1)
BUT ,
if the binary numbers are in points or decimal. How will you convert it into decimal?
Like, 
                 1     0     1  .   1   0    1 
You will solve this by writing in fractions(1/2, 1/4 , 1/8) after decimal & then add with the same method told above:
               1      0      1 .   1     0      1
               4      2      1    1/2  1/4    1/8
               4      +     1      1/2   +  1/8
         Ans:      5   5/8

2. DECIMAL TO BINARY :

1st Method :

Examples:

1. 11 

The conversion is same for decimal to binary . The only difference is we will inverse the process ..
                      8     4    2    1
Write such Binary numbers which make a sum of 11
                      8     4    2    1
                      1     0    1    1 
2. 28
                     16    8      4    2    1
                      1     1      1    0    0

2nd Method : (LCM Method)

Example :

1. 56
                  
How to convert by LCM Method

                 
In this method , we will take the LCM of the given number but only with 2 . Obviously the remainder is always not zero . The number written with a arrow is the remainder after dividing it from 2 now the answer will be  from tail to head of  the arrow . So , the answer is 111000.
2. 17
Binary Conversions
Answer :   10001 

3. BINARY TO HEXADECIMAL :

To convert it in HEXADECIMAL , divide the given binary number into two parts and add those whose binary number is ON(equal to 1)
Example #1:
                      
  1        0        1        0    1     0      1     1
                    
   8        4        2        1    8     4      2     1 
         8+2=10                    8+2+1=11
But, in Hexa 10=A and 11=B
Ans : AB

Example #2:

1 0 1 0  0 0 1 1  1 0 0 1  0 1 0 1
8 4 2 1  8 4 2 1  8 4 2 1  8 4 2 1
8+2=10  2+1=3  8+1=9  4+1=5
But ,
10=A in HexaDecimal 
Ans = A395

4.HEXADECIMAL TO BINARY:

Example:
                                 F                5 = ?
                             8  4   2   1    8   4   2   1
  (As F =15... 8+4+2+1=15 & 4 +1)
                       Ans:    1   1    1    1   0   1   0   1 

5. OCTAL TO BINARY:

Example # 1:
*72
Solve:
                     7             2
                 4  2  1         4  2  1
                 1  1  1         0  1  0
Example # 2:
 *28
The number 28 can't convert to BINARY because the range of octal is 0-7 & when we can only use 4 2 1 for conversion . And 4 2 1 gives a sum of 7. So, we can't convert a number which is greater than 7 in OCTAL to BINARY conversion.
Example # 3:
*123
Solve:
              1         2          3
           4 2 1     4 2 1    4 2 1
           0 0 1     0 1 0    0 1 1

6. HEXA TO DECIMAL :

For Hexa  conversion , we will not use 2 power n formula we will use 16n(16 power n)
Then , we will solve with 
n=0(1)
n=1(16)
n=2(256)
n=3(4096)
Example :
*Convert 45 into Decimal ?
                       4             5
                      16            1
Then , multiply both, Like,
4*16=64 & 5*1=5
Add the answers ,
64 + 5 = 69

7.OCTAL TO DECIMAL :

We will use 8 power n formula for Octal conversions
8n  ➝   512   64   8  1 
Example:
                     
                  2      2       3
                 64     8       1
Multiply,
2*64=128 
2*8=16
3*1=3
Then Add the results
128+16+3=147
Answer : 147 

ARITHMETIC IN BINARY :

   0              1             0              1
+ 0          + 0        +   1          +  1
   ㅡ            ㅡ            ㅡ               
   0             1             1              10
Example # 1:

1   0   1
1   1   0
---------
10 1   1
Example #2:

1  0
1  1
-----
10  1
Example #3:
1  1  0
0  1  0
--------
10 0  0

Example #4:
            1     0     1     0    1     1        1
     +     1     0     0     1    0     1        1
            -----------------------------------
            10   1    0       0    0     1       0 
           ------------------------------------

*******------------------**********--------*******
I tried my level best to guide you in Binary Conversion but if you find any difficulty then you are free to ask in the comment section.
----------
How to do binary conversions
How to do binary conversions
How to do binary conversions
How to do binary conversions
How to do binary conversions
---------
Everything @WorldTrueSight