This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int SLL_GetNodeCount(Node* Head) | |
{ | |
int i=0; | |
Node* Tail = Head; | |
while(Tail->NextNode != NULL) | |
{ | |
Tail=Tail->NextNode; | |
i++; | |
} | |
return i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LINKEDLIST_H | |
#define LINKEDLIST_H | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef int ElementType; | |
typedef struct tagNode | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LinkedList.h" | |
Node* SLL_CreateNode(ElementType NewData) | |
{ | |
Node* NewNode = (Node *)malloc(sizeof(Node*)); | |
NewNode->Data = NewData; | |
NewNode->NextNode = NULL; | |
return NewNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LinkedList.h" | |
int main(void) | |
{ | |
int i=0; | |
int count=0; | |
Node* List=NULL; | |
Node* NewNode=NULL; | |
Node* Current=NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SLL_InsertHead(Node** Head, Node* NewHead) | |
{ | |
if((*Head) == NULL) | |
*Head = NewHead; | |
else | |
{ | |
//NewHead->NextNode = (*Head)->NextNode; | |
NewHead->NextNode = *Head; | |
*Head = NewHead; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
while(1) | |
{ | |
int num; | |
printf("input number: "); | |
scanf("%d", &num); | |
if(num==0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
char* changeText(char*); | |
int main(void) | |
{ | |
char str[10]; | |
printf("input: "); | |
scanf("%s", str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class euler01 { | |
public static void main(String[] args) { | |
int sum=0; | |
for(int i=0; i<1000; i++) { | |
if(i%3 == 0 || i%5 == 0){ | |
sum += i; | |
} | |
} | |
System.out.println(sum); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class euler02 { | |
public static void main(String[] args) { | |
int firstFibo=1; | |
int secondFibo=2; | |
int sum=2; | |
while(true) { | |
int numFibo = firstFibo + secondFibo; | |
if(numFibo > 4000000) { | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class euler03 { | |
public static int getPrimeNum(int num){ | |
int maxPrimeNum=0; | |
int limit=10; | |
for(int i=0; i<limit; i++) { | |
if(!(i%num == 0)) { | |
maxPrimeNum = i; | |
if(i*i >= limit) { | |
return maxPrimeNum; | |
} |