Example of single node with multiple elements, Data Structure & Algorithms

Assignment Help:

The class Element represents a single node that can be part of multiple elements on a hotplate and runs in its own thread. The constructor accepts the initial temperature and a heat constant that should be between 0.0 (exclusive) and 1.0. The start method should start running the thread. While running the element compares the average temperatures of its neighbours with its own temperature and adjusts its current temperature using this formula:

currentTemp += (averageTemps - currentTemp) _ heatConstant

The elements own temperature can be increased or decreased by calling the method applyTempToElement using this formula:

currentTemp += (appliedTemp - currentTemp) _ heatConstant.

Because neighbour elements are running in their own threads and accessing each others temperature, careful synchronization will be needed whenever the temperature field is accessed or changed. Using the UML diagram below as a guide.

2411_elements.png


Related Discussions:- Example of single node with multiple elements

Exact analysis of insertion sort, Exact analysis of insertion sort: Let...

Exact analysis of insertion sort: Let us assume the following pseudocode to analyse the exact runtime complexity of insertion sort. T j   is the time taken to execute the s

Binary search trees, In this unit, we discussed Binary Search Trees, AVL tr...

In this unit, we discussed Binary Search Trees, AVL trees and B-trees. The outstanding feature of Binary Search Trees is that all of the elements of the left subtree of the root

Search engines - applications of linear and binary search, Search engines e...

Search engines employ software robots to survey the Web & build their databases. Web documents retrieved & indexed through keywords. While you enter a query at search engine websit

Signals, How does cpu''s part tming and controls generate and controls sign...

How does cpu''s part tming and controls generate and controls signls in computer?

Drawback of sequential file, Following are some of the drawback of sequenti...

Following are some of the drawback of sequential file organisation: Updates are not simply accommodated. By definition, random access is impossible. All records should be

Euclidean algorithm, The Euclidean algorithm is an algorithm to decide the ...

The Euclidean algorithm is an algorithm to decide the greatest common divisor of two positive integers. The greatest common divisor of N and M, in short GCD(M,N), is the largest in

Algorithm for determining who won rock paper scissors game, Suppose you are...

Suppose you are given the results of 5 games of rock-paper-scissors. The results are given to you on separate pieces of paper; each piece says either 'A' if the first person won, o

The complexity of multiplying two matrices, The complexity of multiplying t...

The complexity of multiplying two matrices of order m*n and n*p is    mnp

ALGORITHMS, WRITE AN ALGORITHM TO READ TWO NUMBERS AND PRINT THE LOWER VALU...

WRITE AN ALGORITHM TO READ TWO NUMBERS AND PRINT THE LOWER VALUE

Define techniques of dry running of flowcharts, Explain the term- Dry runni...

Explain the term- Dry running of flowcharts  Dry running of flowcharts is essentially a technique to: Determine output for a known set of data to check it carries out th

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd