In: Nursing
Why do you think CSS is such a popular choice among web designers? List 3 advantages in programming websites with CSS and support your assertions with examples. Also list 2 common challenges with CSS and how designers can overcome these problems.
In: Computer Science
In: Anatomy and Physiology
List several advantages that method of steepest descent has over Newton's method and give a brief explanation of each advantage. Also list advantages that Newton's method has over steepest descent method and give a brief explanation of each advantage as well.
In: Computer Science
Q14 Describe a maintenance plan for: a) Vacuum, and b) SF6 breakers • Cover the two types separately. • Be specific and do not list generic information (some research may be required). • List any special precautions during maintenance. • 10 + 5 = 15 marks.
In: Electrical Engineering
In C++, write a function that takes in as inputs two arrays, foo and bar, and their respective array sizes. The function should then output the concatenation of the two arrays as a singly linked list. You may assume that you are provided a singly linked list header file.
In: Computer Science
1. What is an animal? List characteristics describing animals.
2. What is the Cambrian Explosion?
3. Is the kingdom “Animalia” monophyletic or polyphyletic?
4. How do you describe invertebrates? What are examples of invertebrates?
5. List criteria that are used to classify invertebrates.
In: Biology
Write a function argmax(somelist=[]) to return the index of the largest number in a numerical list, or None if the list is empty. If there are ties, then return the index of the first occurrence of the largest number. Sample: argmax([2, 2, 4, 4, 1]) returns 2. in python program
In: Computer Science
Q1- Write a program that takes a list of values as an input from the user. The program should further ask the user about sorting the list in ascending or descending order. It is desirable to use Arraylist/Vector in place of simple arrays. (Object Oriented Programming java)
In: Computer Science
This is an assignment that I'm having trouble figuring out in python:
Modify Node class so it has a field called frequency and initialize it as one.
Add a search function. If a number is in the list, return its frequency.
Modify Insert function. Remove push, append, and insertAfter as one function called insert(self, data). If you insert a data that is already in the list, simply increase this node’s frequency. If the number is not in the list, add it to the beginning of the list.
Modify Delete function. When you delete a node, reduce its frequency. If frequency becomes zero, remove the node from the list.
Modify Print function to print out all the numbers with their frequency in the list.
The program that we are suppose to modify:
class Node:
def __init__(self,d):
self.data=d;# data in the node
self.next=None #address of next node
"""add a field called frequency here"""
class LinkedList:
def __init__(self):
self.head=None #linked list at the beginning is empty. head is
None
def print(self):#print every node's data
temp=self.head#let temp points to head
while temp:#As long as temp is not None (the end)
"""modify print, so frequency is also printed out frequency
"""
print(temp.data,end="")#print data
temp=temp.next # let temp points to the next Node
print()
"""complete the folloing function """
def insert(self,d):
temp=self.head
"""
travel the list like print, if d is in there break the loop
if yes, increase its freq
if not add it the front of the list like "push"
"""
"""
def push(self,new_d):#will add new node at the beginning
newNode=Node(new_d) #create a Node
newNode.next=self.head #Let new Node's next to be the original
head
self.head=newNode #update head as the New Node
def insertAfter(self,prev_data, new_data):
temp=self.head#let temp be the head
while temp and temp.data!=prev_data:#as long temp is not None and
data is not prev_data
temp=temp.next
#if you can get here. One of the condition must be false
if temp==None:#There is no prev_data because you have reached the
end
print("The given previous node does not exist")
return
#if you can reach here, temp.data=prev.data
newNode=Node(new_data)#create a new node after Node temp
newNode.next=temp.next#make newNode's next as temp's next
temp.next=newNode# make temp's(prev) next as NewNode
def append(self,new_data):# add new_data at the end of the
list
newNode=Node(new_data)#create a Node with new_data
if self.head==None:#in case the list is empty
self.head=newNode
return
last=self.head#let last be head
while last.next:#as long last next is not None, continue
last=last.next# let last as its next
#when loop terminates, last.next is None, therefore last points to
the last Node
last.next=newNode
"""
def delete(self,key):#delete a Node with data "key"
temp=self.head #let temp be head
if temp is not None:#if list is not empty
if temp.data==key:#if key is at the first Node
"""reduce temp'frequency
if its frequency becomes 0, execute the next three lines"""
self.head=temp.next #let head to head's next
temp=None
return
while temp is not None:#if list is not empty
if temp.data==key:#loop ends if key is found
break
prev=temp#prev is node before
temp=temp.next
#Loop ends either temp is None or loop ends because of "break"
which means key is found
if temp==None:
return #return because key is not in the list
#when temp.data is same as key
"""reduce temp'frequency
if its frequency becomes 0, execute the next three lines"""
prev.next=temp.next
temp=None
list=LinkedList()
list.insert(5)
list.insert(9)
list.insert(5)
list.insert(6)
list.insert(6)
list.insert(9)
list.print()
list.delete(5)
list.print()
list.delete(5)
list.print()
list.delete(6)
list.print()
list.delete(6)
list.print()
In: Computer Science