Wednesday, July 25, 2012

Set difference


Problem :  Given 2 arrays such that second is the subset of the first, find the set difference.
That is all the elements in array1 that are not in array2.
Eg:  
array1 - 6 7 4 3 9 1 2 5 8 0
array2 - 1 2 3 5 4
Set difference - 6 7 9 8 0

#include<stdio.h>

int main()
{
  int s1, s2, i, j, k = 0, check, a1[50], a2[50], a3[50];
  printf("\nEnter the size of array1:");
  scanf("%d", &s1);
  printf("\nEnter the elements\n");
  for(i = 0; i < s1; i++)
    scanf("%d", &a1[i]);
  printf("\nEnter the size of array2 < size of array1:");
  scanf("%d", &s2);
  printf("\nEnter the elements (should be a subset of array1)\n");
  for(i = 0; i < s2; i++)
    scanf("%d", &a2[i]);

  for(i = 0; i < s1; i++)
  {
    check = 1;
    for(j = 0; (j < s2 && check == 1); j++)
    {
      if(a1[i] != a2[j])
        continue;
      else
        check = 0;
    }
    if(check == 1)
      a3[k++] = a1[i];
  }
  printf("\nSet difference:\n");
  for(i = 0; i < k; i++)
    printf("%d ", a3[i]);

  return 0;
}

Written by

Saturday, July 21, 2012

Interview question(coding) - 2 :

Problem : Given an array, construct another array where i-th element
is the product of all but i-th elementof original array 
Example : array size = 5
          array = 5 1 2 3 4
          resultant array = 24 120 60 40 30
1*2*3*4 = 24, 5*2*3*4 = 120, 5*1*3*4 = 60, 5*1*2*4 = 40, 5*1*2*3 =30
          
#include<stdio.h>
 
int main()
{
  int a[50], b[50], i, j, n, prod;
  printf("Enter the size of the array ( < 50 ): ");
  scanf("%d", &n);
  printf("\nEnter the elements of the array : ");
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);
 
  for(i = 0; i < n; i++)
  { 
    prod = 1;
    for(j = 0; j < n; j++)
    {
      if(j != i)
        prod = prod * a[j];
    }
    b[i] = prod;
  }
  printf("\nThe resultant array\n");
  for(i = 0; i < n; i++)
    printf("%d ", b[i]);
    
  return 0;
}
Written by

Interview question (coding) : Remove duplicates from a string


Problem : Given a string, remove the duplicate characters.
example: BANANAS -> BANS
         bananas -> bans
         BaNanAs -> BaNnAs
         1232416 - > 12346
         
#include<stdio.h>
 
int main()
{
  char s1[10], s2[10];
  int i, j, c;
  s2[0] = '\0';
 
  printf("Enter the string : ");
  scanf("%s",s1);
 
  for(i = 0; s1[i] != '\0'; i++)
  {
    c = 0;
    for(j = 0; (s2[j] != '\0' && c == 0); j++)
    {
      if(s1[i] != s2[j])
        continue;
      else
        c = 1;
    } 
    if(c == 0)
    {
      s2[j++] = s1[i];
      s2[j] = '\0';
    }
  }
  printf("\nString after removing duplicates:%s\n", s2);

  return 0;
}

Written by

Saturday, July 7, 2012

GATE 2013 Syllabus - Computer Science & Information Technology


GATE 2013 - SYLLABUS FOR COMPUTER SCIENCE AND INFORMATION TECHNOLOGY (CS)

Engineering Mathematics

Mathematical Logic:
Propositional Logic; First Order Logic.

Probability:
Conditional Probability; Mean, Median, Mode and Standard Deviation; Random Variables; Distributions; uniform, normal, exponential, Poisson, Binomial.

Set Theory & Algebra:
Sets; Relations; Functions; Groups; Partial Orders; Lattice; Boolean Algebra.

Combinatorics:
Permutations; Combinations; Counting; Summation; generating functions; recurrence relations; asymptotics.

Graph Theory:
Connectivity; spanning trees; Cut vertices & edges; covering; matching; independent sets; Colouring; Planarity; Isomorphism.

Linear Algebra:
Algebra of matrices, determinants, systems of linear equations, Eigen values and Eigen vectors.

Numerical Methods:
LU decomposition for systems of linear equations; numerical solutions of non-linear algebraic equations by Secant, Bisection and Newton-Raphson Methods; Numerical integration by trapezoidal and Simpson's rules.

Calculus:
Limit, Continuity & differentiability, Mean value Theorems, Theorems of integral calculus, evaluation of definite & improper integrals, Partial derivatives, Total derivatives, maxima & minima.

Computer Science and Information Technology

Digital Logic:
Logic functions, Minimization, Design and synthesis of combinational and sequential circuits; Number representation and computer arithmetic (fixed and floating point).

Computer Organization and Architecture:
Machine instructions and addressing modes, ALU and data-path, CPU control design, Memory interface, I/O interface (Interrupt and DMA mode), Instruction pipelining, Cache and main memory, Secondary storage.

Programming and Data Structures:
Programming in C; Functions, Recursion, Parameter passing, Scope, Binding; Abstract data types, Arrays, Stacks, Queues, Linked Lists, Trees, Binary search trees, Binary heaps.

Algorithms:
Analysis, Asymptotic notation, Notions of space and time complexity, Worst and average case analysis; Design: Greedy approach, Dynamic programming, Divide-and-conquer; Tree and graph traversals, Connected components, Spanning trees, Shortest paths; Hashing, Sorting, Searching. Asymptotic analysis (best, worst, average cases) of time and space, upper and lower bounds, Basic concepts of complexity classes  P, NP, NP-hard, NP-complete.

Theory of Computation:
Regular languages and finite automata, Context free languages and Push-down automata, Recursively enumerable sets and Turing machines, Undecidability.

Compiler Design:
Lexical analysis, Parsing, Syntax directed translation, Runtime environments, Intermediate and target code generation, Basics of code optimization.

Operating System:
Processes, Threads, Inter-process communication, Concurrency, Synchronization, Deadlock, CPU scheduling, Memory management and virtual memory, File systems, I/O systems, Protection and security.

Databases:
ER-model, Relational model (relational algebra, tuple calculus), Database design (integrity constraints, normal forms), Query languages (SQL), File structures (sequential files, indexing, B and B+ trees), Transactions and concurrency control.

Information Systems and Software Engineering:
information gathering, requirement and feasibility analysis, data flow diagrams, process specifications, input/output design, process life cycle, planning and managing the project, design, coding, testing, implementation, maintenance.

Computer Networks:
ISO/OSI stack, LAN technologies (Ethernet, Token ring), Flow and error control techniques, Routing algorithms, Congestion control, TCP/UDP and sockets, IP(v4), Application layer protocols (icmp, dns, smtp, pop, ftp, http); Basic concepts of hubs, switches, gateways, and routers. Network security  basic concepts of public key and private key cryptography, digital signature, firewalls.

Web technologies:
HTML, XML, basic concepts of client-server computing.


GATE 2013 Comprehensive Information Page @ http://www.codeblocks.info/2012/08/gate-2013.html

GATE Previous Years Question Papers can be accessed @ http://www.codeblocks.info/p/gate-computer-sciencecs-previous.html

Information courtesy: IITB Gate 2013 Website.

Tuesday, July 3, 2012

GATE 2013 - Notification, Application & Exam Date

GATE 2013 Comprehensive Information Pagehttp://www.codeblocks.info/2012/08/gate-2013.html


Dates of Examination


Online: 20th January 2013 (Sunday)

Offline: 10th February 2013 (Sunday)

What is New in GATE 2013 ?


Online papers: AE, AG, AR, BT, CE, CH, CY, GG, MA, Mn, MT, PH, TF, XE, and Xl
Offline papers: CS, EC, EE, in, ME, and Pi

Application Fee


  • 1200 for General/OBC male applicants
  • 600 for SC/ST/PD male applicants
  • There is no application fee for female applicants
  • The application fee is not refundable

Application Deadlines


Commencement of online application: 1st September 2012 (Saturday)
Last date for:
  • Submission of online application (website closure): 30th September 2012 (Sunday)
  • Receipt of application with supporting documents at gate offices: 8th October 2012 (Monday)
GATE Previous Years Question Papers can be accessed @ http://www.codeblocks.info/p/gate-computer-sciencecs-previous.html

Information courtesy: IITB Gate 2013 Website.
Written by