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> | |
/* Logic : Do the following thing until the list is sorted | |
(i) Compare two adjacent elements and check if they are in correct order(that is second one has | |
to be greater than the first). | |
(ii) Swap them if they are not in correct order. | |
*/ | |
void BubbleSort(int *array,int number_of_elements) | |
{ | |
int iter, temp, swapped; | |
do |
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
The problem statement is given below: | |
Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to express himself through emoticons, he hates unbalanced parenthesis so much that it makes him go :( | |
Sometimes he puts emoticons within parentheses, and you find it hard to tell if a parenthesis really is a parenthesis or part of an emoticon. | |
A message has balanced parentheses if it consists of one of the following: | |
1. An empty string "" | |
2. One or more of the following characters: 'a' to 'z', ' ' (a space) or ':' (a colon) | |
3. An open parenthesis '(', followed by a message with balanced parentheses, followed by a close parenthesis ')'. | |
4. A message with balanced parentheses followed by another message with balanced parentheses. |
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
//visit http://vikash-thiswillgoaway.blogspot.com for solution of other problems | |
import java.io.File; | |
import java.io.FileReader; | |
import java.io.FileWriter; | |
import java.io.LineNumberReader; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
/** | |
* |
NewerOlder