Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Vamsi Tallapudi vamsitallapudi

🎯
Focusing
View GitHub Profile
View InsertAtFront.py
# insertion of new node at front of linked list
def insert_at_front(head, data):
# creating new node to be inserted
new_node = Node(data)
new_node.next = head # pointing the new node's next to head
head = new_node # making the new node as head
return head
View TraversingLinkedList.py
class Node:
def __init__(self, data):
self.data = data # assigning the data passed
self.next = None # initializing the node as null
class LinkedList:
def __init__(self):
self.head = None
View LinkedListCreation.py
class Node:
def __init__(self, data):
self.data = data # assigning the data passed
self.next = None # initializing the node as null
class LinkedList:
def __init__(self):
self.head = None
View Node.py
class Node:
def __init__(self, data):
self.data = data # assigning the data passed
self.next = None # initializing the node as null
View PermutationInString.kt
class PermutationInString {
fun checkInclusion(s1:String, s2: String): Boolean {
val len1 = s1.length
val len2 = s2.length
val value = Array(26) {0}
if (len2 < len1) return false
for (i in 0 until len1) {
// filling value array with the frequencies of string 1
value[s1[i] - 'a']++
View SearchDataSource.kt
...
val providers = ServiceLoader.load(DataSourceProvider::class.java, null)
val dataSources = providers.map {
it.getDataSource(activity)
}.toSet()
...
View DataSourceProvider.kt
interface DataSourceProvider {
fun getDataSource(context:Context):DataSource
}
View StoriesDataSourceProvider.kt
class StoriesDataSourceProvider : DataSourceProvider {
override fun getDataSource(context:Context) : DataSource {
//build dependencies
return datasource
}
}
You can’t perform that action at this time.