Skip to content

Instantly share code, notes, and snippets.

View Bjacksonshorts's full-sized avatar

Bjacksonshorts

View GitHub Profile
puts "what is your temperature (write degree as C or F)"
degree = gets.chomp;
if degree.include?("F")
degreeC = degree.split("") - ["F"]
newDegree = degreeC.join.to_i * 9/5 +32
puts "the Temperature is " + newDegree.to_s + " degrees Celsius"
end
if degree.include?("C")
alpha = "abcdefghijklmnopqrstuvwxyz"
key = 2
puts "what is your input"
name = gets.chomp
for i in alpha.split("")
c = name.split("")[alpha.index(i)]
o = alpha.index(c)
m = o + key
p = alpha.split("")[m]
function Queue() {
this.tail = null;
this.head = null;
}
Queue.prototype.enqueue = function(n) {
if(this.head == null){
this.head = n;
this.tail = n;
}
else{
function Stack(){
this.top = null;
this.length = 0;
}
Stack.prototype.push = function(n){
//the new node has to be the top so the old top should become the new node's NextNode because it should be second
n.setNextNode(this.top);
//then you should make the new node the top
this.top = n;
var counter = 0;
var n = new Node()
Stack = function(){
This.top = null;
}
Stack.prototype.push = function(){
if( this.top == null){
this.top = n;
function Queue() {
this.tail = null;
this.head = null;
}
Queue.prototype.enqueue = function(n) {
//this.head = n;
//n.getNextNode = this.tail;
if(this.head == null){
this.head = n;
return this.head;