Wednesday, December 18, 2013

Adding 3 Linked Lists


Last Time we discussed the basics of Linked List Today we will try adding more more than 2 Linked Lists. Although in the program you will see that I have manually created Lists and then adding them in a very constrained manner which can be overcome by introducing dynamic looping as per the program requirements.


#include <stdio.h>
#include <stdlib.h>

struct Node
{
    int info;
    struct Node* next;
};

int lenghtOfLinkedList(struct Node*); // This method is count the number of elements in a list and on the basis of max count neutralize all other to bring them to the format of largest one.
void createLinkedListA(struct Node*); // create a sample linked list
void createLinkedListB(struct Node*); // create a sample linked list
void createLinkedListC(struct Node*); // create a sample linked list

Now we have linked lists
A = head->6->7->8->9
B = head->1->2->3
c = head->4->5

void neutralizeLinkedList(struct Node*, int, int); 


Now after neutralizing we have linked lists
A = head->6->7->8->9
B = head->0->1->2->3
C = head->0->0->4->5

Tuesday, December 10, 2013

Back To Primitive Code: Creating a Linked List


The below code explains procedure to how to create a Singly-Linked-List and Print Data in that List.

#include <stdio.h>

/*This part of the code is to create a structure in which we create the simplest entity in the List which is a Node
 <Code below is definition of single Node>
The Node consists of the internal Data which can be anything from primitive data to an array to another structure.
*/
struct Node
{
    int info;
    struct Node *next;
};

/*Now to create a linked list what we require is a HEAD to mark the beginning of the Linked-List followed by a TEMP to track the current node being processed, followed by a Temp Definition of NEWNODE which will be created at run-time*/

int main()
{
    int i = 0;
    struct Node *head = (struct Node*)malloc(sizeof(struct Node));
    struct Node *temp = NULL;  
    struct Node *newnode = NULL;  

Saturday, November 2, 2013

Most Optimized Code for Sorting


Hi,

All of you must have come across statements and questions online or technical exams or placement exams asking for the MOST OPTIMIZED Code for sorting. Below I have shared a code to do that.
The Code is easy to understand and implement.

#include <stdio.h>
#include <math.h>

void createArray(int *array_players, int nlenght);
void createTournament(int *arry_players, int nlenght);
int findNextMax(int arry_players[], int nlenght);


int main()
{
    int i, arry_players[100], nlenght, max_value, nextMax_value, sorted_array[100];

    printf("Enter Number of Elements in Array ");
    scanf("%d",&nlenght);

    createArray(arry_players, nlenght);

Saturday, July 27, 2013

Project Euler Solved using C# : 10001st prime


By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?

what you have to do is traverse and check if the number is prime. The most important concept to remember is
  • 2 is the only EVEN prime number
  • 3 onwards all prime numbers are ODD
  • a number is considered to be prime if it is Divisible by any number Less Than or Equal To SQUAREROOT of (Suspected Number).
Answer to the Problem is : 104743

 
 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace ProjectEuler  
 {  
   class PrimeAtPlace  
   {  
   

Project Euler Solved using C# : Sum square difference


The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

Remember Sigma(n) = (n*(n+1))/2
and Sigma(n^2) = (n*(n+1)*(2n+1))/6 

Equating them w.r.t to given problem = Sigma(n)^2 - Sigma(n^2) is

(n * ((n * n) - 1) * ((3 * n) + 2)) / 12

Answer to the Problem is :  25164150
 using System;  
 namespace ProjectEuler  
 {  
   class SquareAndSum  
   { 

Project Euler Solved using C# : Smallest multiple


2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

 The Solution to this problem is very simple simply what one has to do is logically think what the question demands, The problem statement wants you to find the largest common factor to all the given numbers, so what you have to do is to find the largest common factor to all the numbers from1 to 20.

The program to solve this problem in C# is below, call this class in the "static main()" function and get the required solution. Answer to this problem is :232792560

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace ProjectEuler  
 {  
   class LargestCommonFactor  
   {  
     private int _upperlimit = 20;  
     private List<int> _primenumbers = new List<int>();  
     private List<int> _LCMcandidates = new List<int>();  
     public Dictionary<int, int> _primepowerpair = new Dictionary<int, int>();  
     public LargestCommonFactor() 
     

Sunday, March 25, 2012

HACK FACEBOOK Account Using Phishing | By Neoteric



last week a person requested here to explain how to make a fake login page of Facebook.. So i am giving a lesson here about making fake page of Facebook.


Note: Hacking is a crime. Dont use this tutorial to hack innocent people. I am teaching it for educational purpose only. I will not be responsible for any damage done by you.


First i recommend you all to read my previous article on phishing page "How to make a Fake login page manually"  coz here in this post i m not gonna explain all things as i hv done it before.


well, here we go for creating Fake page of Facebook...
Here we will need 3 types of files for facebook:
1. A php file with any name say login.php. This php file places main role to get the passwords of victim
2. index.html which is a fake html page similar to original Page of Facebook.
3. Photos, CSS, js files