Project Overflow Workflow
This site is an ultimate guide for the people who get confused with different stuffs like education, health, banking, finance, technology etc.
*Acoustic vs electric guitar- Choose which type of guitar you want to learn. Once you have chosen, buy a budget friendly guitar.
*Buy Strap and Guitar Picks- Strap is needed if you want to play guitar by standing. Guitar pics are needed to play the guitar strings and the chords.
Note: If you are a beginner, you must buy a thinner guitar pick. This is because most of the beginners first learn strumming techniques which in turn requires thinner guitar picks.
*Tune the guitar- Take help from the seller or from your experienced friend in tuning of the guitar. If you are playing a guitar for the first time, it is important to tune in the guitar.
On the internet you can find a lot of guitar tuning guides. May be I can post a new article on how to tune a guitar as a beginner.
* Download a Tuning app- Tuning apps can make your journey much better. So you can download gStrings app for android and Guitar Tuna app to learn fine tuning of the guitar. There is another app for the same and its name is metronome.
With the help of these tuner apps, you can tune any musical instrument and your voice.
* Get familiar with the Frets and the Strings- There are 6 strings in a guitar. From top to bottom is 6, 5,4,3,2 and 1. The top most is the 6th string and the bottom most is the 1st string.
The string names are E A D G B E. You can remember this like Eddy Ate Dynamite, Good Bye Eddy.
Similarly the square or rectangular division on the guitar body are called frets. The one closest to your face is the first fret and so on.
* Learn to Read Tablature/ Tab chart
6e__X
5A__0
4D__1
3G__2
2B__0
1E__X
Here X means do not play the string, 0 means play that string open and do not hold the fret. The alphabets are the string names and the numbers on the right are the fret numbers.
* Find and Learn Tabs for your fav songs- There are many sites that provide free tabs for any song. Practice them daily to get better at guitar.
* Learn Scales
1. Practice a Pentatonic scale.
2. Practice the pentatonic scale until you get better and better.
3. Then practice an A minor scale at 5th position. It means that you have to treat the 5th fret as the 1st fret.
4. Practice Shape Scales- This is to make you better in changing the strings so that later you can play the different strings without even looking at them.
5. Practice String Skipping Scales- This will make you better at playing, strumming the guitar cords without even looking at the guitar.
6. Learn and Practice more scales- Search on the internet for more scales. Getting better at playing different scales will help in playing different types of songs. You can even make one if you have a grip on playing different scales. That is it.
Reference:
In this post, we will learn how to play basic guitar chores.
Guitar Parts:
Before you learn something new, you must be familiar with its interface. So a guitar has 6 strings. There are 2 types of guitar: Acoustic and electric guitar.
Hold the guitar correctly:
For this, sit on a straight chair or stool. So when you hold the guitar in your hands, it should be in such a way that the smallest string should point towards the ground and the thickest string should point towards the roof.
The back of the guitar must touch your stomach and chest.
The rectangular divisions are called frets. So first we need to learn 4 basic frets.
What we will learn: A minor, A major, C major, E major, E minor.
So string 1 starts from the bottom, above it stings 2,3,4,5 and the topmost string is the 6th string. The first rectangular division is fret 1, below it is fret 2, fret 3, and so on.
A minor:
Index Finger IF -1st Fret: 2nd String
Middle Finger MF- 2nd Fret: 4th string
Ring Finger RF- 2nd Fret: 3rd string
Note: Do not play the 6th string. Start from the 5th string and play it to 1st string. The more the fingers are closer, the more it will be better.
A major:
IF- 2nd F 4th S
MF- 2nd F 3rd S
RF- 2nd F 2nd S
Again play from 5th to 1st string
C major:
IF- 1st F 2nd S
MF- 2nd F 4th S
RF- 3rd F 5th S
No 6th string should be played
Do not play the 6th string.
E minor:
IF-
MF- 2F 5S
RF- 2F 4S
Play all strings i.e. play from top to bottom i.e. from 6th string to the first string in both E major and E minor.
E major:
IF- 1F 3S
MF- 2F 5S
RF- 2F 4S
IP: [1,2,3,4,5]
OP: [1,2,4,5]
Method1: First we remove all the elements, then push all elements except the middle element. Then pop all elements to print the element.
Code:
void deletemid(stack <char> &st, int n, int curr=0)
{ //do nothing if stack is empty or all items are traversed
//curr is currrent item number
if(st.empty() || curr==n) return;
//remove the currrent item
int x= st.top(); st.pop();
//remove other items;
deletemid(st, n. curr+1);
//put all elements back to stack except middle element
if(curr!=n/2) st.push(x);
} //f ends
int main()
{ stack<char> st;
st.push('1');
st.push('2'); st.push('3'); st.push('4');
st.push('5'); st.push('6'); st.push('7');
deletemid(st, st.size());
//printing the stack after deletion of middle element
while(!st.empty)
{ char p=st.top(); st.pop();
cout<<p<<"";
} return 0;
There are 2 methods to solve this problem.
1. Divide the array into 2 halves and allot equal space to both the stacks.
2. Start the array from the extreme ends.
1. Dividing the array into 2 halves
We will divide the array into 2 parts. Then allot first half of the array to the first stack and the rest half to the 2nd stack.
For example: arr[0] to arr[n/2] for stack1 and arr[n/2+1] to arr[n-1] for stack2. n is the size of the array.
Problem with the method: Inefficient use of the array space. Push operation can result in an overflow of stack even if there is space available.
For example, array size is 8 and we push 4 elements to stack1 and do not push any data to stack2. When we push the 5th element to stack1, there will be overflow even if there is space for 4 more elements.
class twoStacks{
int* arr; int size; int top1, top2;
}
public : twoStacks(int n)
{ size=n; arr=new int[n];
top1=n/2+1; top2= n/2;
}
//push method for stack1
void push1(int element)
{ //check overflow condition
if(top>0) {
top1--; arr[top1]=element;
}
else {
cout<<"stack overflow"<<"by element:"
<<x<<endl; return;
}
} //push1 ends
//push2 for stack2
void push2(int element)
{ if(top2<size-1 {
top2++; arr[top2]= element;
}
else {
cout<<"stack overflow "<<"by element:"<<x<<endl; return;
}
} //push2 ends
//pop1 for stack1
int pop1(){
if(top<=size/2) {
int element= arr[top1]; top1++ ; return element;
}
else {
cout<<"stack underflow" ; exit(1);
}
}
void pop2() {
if(top2>=size/2+1)
{ int element= arr[top2]; top2--; return element;
}
else {cout<<"stack underflow"; exit(1);}
}
int main()
{ twoStacks ts(5); ts.push1(5); ts.push2(10);
ts.push2(15); ts.push1(11); ts.push2(7);
cout<<""popped element from stack1 is"<<":"<<ts.pop1()<<endl;
ts.push2(40);
cout<<"\npopped element from stack2 is"<<":"<<ts.pop2()<<endl;
return 0;
}
Result:
Stack Overflow By element :7 Popped element from stack1 is : 11 Stack Overflow By element :40 Popped element from stack2 is : 15
2. Method2: Stating the stacks from the extremes
In this method, we will start the stack1 from the left and the stack2 from the right. In this way the first element is pushed at index0 and the first element in stack2 is pushed at index n-1.
Both the stacks grow or shrink in the opposite direction.
Code:
class twoStacks{
int *arr; int size; int top1, top2;
}
public:
twoStacks(int n) //constructor
{ size=n; arr= new int[n]; top1=-1;
top2= size;
}
//push1 for stack1
void push1(int element)
{ //therer is atleast 1empty space for the new element
if(top1< top2-1)
{top1++; arr[top1]=element;}
else
{cout<<"stack overflow"; exit(1);}
} //push1 ends
//push2 for stack2
void push2(int element)
{ //there is atlesast one emptyspace for the new element
if(top1<to2-1)
{top2--; arr[top2]=element;}
else
{cout<<"stack overflow"; exit(1);}
} //push2 ends
//pop1 for stack1
int pop1()
{
if (top1>0=)
{int element= arr[top1];
top1--; return element;
}
else
{ cout<<"stack underflow"; exit(1);}
}
//pop2 for stack2
int pop2()
{
if(top2<size)
{int element= arr[top2];
top2++; return element;
}
else{cout<<"stack underflow"; exit(1);}
}
int main()
{
twoStacks ts(5); ts.push1(5); ts.push2(10);
ts.push2(15); ts.push1(11); ts.push2(7);
cout<<"popped element from stack1 is"<<ts.pop1();
ts.push2(40);
cout<<"\npopped element from stack2 is"<<ts.pop2();
return 0;
}
Reference
https://www-geeksforgeeks-org.cdn.ampproject.org/v/s/www.geeksforgeeks.org/implement-two-stacks-in-an-array/amp/?amp_js_v=a2&_gsa=1&usqp=mq331AQHKAFQArABIA%3D%3D#aoh=16121771215341&referrer=https%3A%2F%2Fwww.google.com&_tf=From%20%251%24s&share=https%3A%2F%2Fwww.geeksforgeeks.org%2Fimplement-two-stacks-in-an-array%2F
In this post we have to complete the push(), pop() methods using an array.
Hint:
1. For push increase the top and assign arr[top]= element to be pushed
Before pushing an element, check the overflow condition. For pushing element, the array
void push(int element)
{ //check overflow condition
if(top>=size_of_array) cout<<"overflow condition"<<endl;
else
{ top++; stack[top]=element;}
}
For pop, return top element and decrement top. Before popping an element, check for underflow conditions.
void pop(int element)
{ //check underflow condition
if(top<=-1) {cout<<"underflow condtion"<<endl;}
else {cout<<stack[top]<<endl; top--;}
}